简体   繁体   中英

ModuleNotFoundError: No module named 'streamlit' when loading into my Heroku app

I'm using Python 3.8.5

I've made an app in Python that uses Streamlit, and when I deploy it using Heroku, I get this error when loading into the page.

My requirements.txt file contains all the packages and their versions including Streamlit.

matplotlib==3.3.3
pandas==1.1.5
numpy==1.19.5
streamlit==0.74.1
tensorflow-cpu==2.4.0
seaborn==0.11.1
Pillow==8.1.0

My setup.sh file:

mkdir -p ~/.streamlit/

echo "\
[server]\n\
headless = true\n\
port = $PORT\n\
enableCORS = false\n\
\n\
" > ~/.streamlit/config.toml

My Procfile :

web: sh setup.sh && streamlit run site.py

I've tried several different versions of Streamlit but I always get the same the same error. Any help would be greatly appreciated!

Change the name of your site from site.py to something else, for example my_site.py . Streamlit tries to import a module called site but your file is named site.py .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM