dm5
dm5

Reputation: 350

Streamlit on macbook

I need to deploy my keras model as a web application using streamlit. pip install streamlit on terminal results into watchdog error which I have failed to fix. I then tried to install streamlit (latest version 0.59.0) direct on Pycharm, I still get watchdog error. So, instead I installed streamlit 0.1 which is the oldest version, installation was succesful. Now I am having attribute errors when I use streamlit's sidebar

AttributeError: module 'streamlit' has no attribute 'sidebar'

when running `st.sidebar.title("About")

Is this because I am using an older version of streamlit?.

I am using Python 3.6, keras 2.3.1 and tensorflow 1.15.0rc0`

Here is the error when I install streamlit 0.59

ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/61/37mkt9tn1mn4862dj16flw200000gn/T/pycharm-packaging/watchdog/setup.py'"'"'; file='"'"'/private/var/folders/61/37mkt9tn1mn4862dj16flw200000gn/T/pycharm-packaging/watchdog/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/61/37mkt9tn1mn4862dj16flw200000gn/T/pip-record-ee5z2nr5/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m/watchdog Check the logs for full command output.

Upvotes: 0

Views: 12298

Answers (3)

Prasant Poudel
Prasant Poudel

Reputation: 1

Make an virtual environment by using following commands (make sure you have Anaconda Navigator installed):

To create the environment:

$ conda create -n sandbox python=3.7.9

To run it:

$ conda activate sandbox

After activating, use this command to install streamlit

$ pip install streamlit

To close the environment:

$ conda deactivate

Upvotes: 0

Stryker
Stryker

Reputation: 6120

It would be better to run your streamlit and python in a virtual environment to have less dependency on the pre-installed version of python on your system.

Assuming python3 is installed on your system you can create a virtual env like:

python3 -m venv env

To activate the virtual env

source ./env/bin/activate

Now within this environment, you can install the version of streamlit and other libraries you need.

Upvotes: 0

Jeereddy
Jeereddy

Reputation: 1082

The issue is with python version 3.8.2 as mentioned in the below link.

https://github.com/streamlit/streamlit/issues/283

Follow below steps:

  1. Update python to > 3.8.6

    brew upgrade python3

  2. Install watchdog separately.

    pip3 install watchdog

  3. Install streamlit

    pip3 install streamlit

Upvotes: 3

Related Questions