I have an error when I deploy streamlit app on Heroku. How can I deal with ?
5 Answers
This happens when you Install multiple streamlit packages from different folders like when you cloned a project and you install their requirements in your global environment In this case best possible thing that can be done is to uninstall streamlit dependencies present in your system by
pip uninstall streamlit
The install it again using,
pip install streamlit
It should remove all the conflicts and your application should work now. and remember to install the new requirements in your virtual environment if you install all the requirements in your global environments these conflicts occur.
then simply run streamlit run command using
streamlit run app.py
All things should work fine now.

- 89
- 1
- 5
You need to do the following steps:
- Create the virtualenv.
- Activate virtualenv.
- Then, you need to install the following packages:
pip install streamlit
pip install networkx
You would also install any other dependencies you need to run your script as well before running:
streamlit run yourscript.py

- 58
- 10
-
I have created an environment, and I check my "requirements.txt" file, I lack the package "networkx", when I install finished and deploy again, the problem still exist . – Jim Ya Jun 28 '21 at 11:49
-
Did you install the requirements.txt file using `pip install -r requirements.txt`? Install the package "networkx" separately then. – Nitin Jun 28 '21 at 11:55
-
I creates a app on heroku, not on my local. So packages are installed at the same time from "requirements.txt" – Jim Ya Jun 28 '21 at 12:10
Try upgrading streamlit (this worked for me)
pip install --upgrade streamlit
Otherweise reinstall
pip uninstall streamlit
pip install streamlit

- 2,427
- 5
- 41
- 66
Updating the answer here for future users.
The package has been moved to streamlit.web module. So the current way is,
import streamlit.web.cli as stcli

- 11
- 2
Open Anaconda and click on Environments Then click on Play button and then click on Open Terminal
If you use Python 3 then install apt pip through:
sudo apt-get install python3-pip
Then Install pipenv through
pip3 install pipenv
Then you can install streamlit through:
pipenv install streamlit
You can run python files through streamlit as usual:
streamlit run my_file.py
Create a new environment with streamlit
Directly go to the folder where your project is located, click on the address bar then click on "Copy link as text", then change your working directory through
cd /your_copied_path
Create a new pipenv environment in that folder
pipenv
You can again install streamlit through pipenv:
pipenv install streamlit
Then you can just open your streamlit python file:
streamlit my_file.py
If this answer was helpful you can just like by clicking heart
Thanks for reading!!!

- 1
- 1
-
Welcome to StackOverflow. [Asking for upvotes](https://meta.stackoverflow.com/questions/323847/is-it-okay-to-ask-for-upvotes-in-a-question) is NOT allowed, please edit your answer, thanks. – thedemons Oct 20 '22 at 00:33