I have an error when I deploy streamlit app on Heroku. How can I deal with ?
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.
Try upgrading streamlit (this worked for me)
pip install --upgrade streamlit
Otherwise reinstall
pip uninstall streamlit
pip install streamlit
For me following command worked in mac
conda update -c conda-forge streamlit -y
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
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
pip install -r requirements.txt
? Install the package "networkx" separately then. –
Mend 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!!!
I managed to get it to work by killing the current terminal and opening a new one. Then activating the virtual environment.
- kill the current VS Code terminal
- Open a new terminal in VS Code
- Activate the virtual environment
source venv/bin/activate
https://discuss.streamlit.io/t/streamlit-does-not-use-venv/10791/2
© 2022 - 2025 — McMap. All rights reserved.