Hello guys,
When i try to deploy streamlit to heroku i get this below error.How can i fix it?
No module named streamlit.main; āstreamlitā is a package and cannot be directly executed
Hello guys,
When i try to deploy streamlit to heroku i get this below error.How can i fix it?
No module named streamlit.main; āstreamlitā is a package and cannot be directly executed
What versions of python are you running?
Hey @M11, welcome to Streamlit!
The streamlit
command lives in your virtualenvās bin/
folder. It looks like pipenv run
isnāt looking in that folder, and is instead finding the package called streamlit, and trying to execute that instead.
Without seeing any details of what your Heroku deployment looks like, itās hard to offer concrete advice to fix this issue. But from your screenshots, it looks like youāre executing this command from within a pipenv shell. Since youāre already in the shell, you donāt need to use pipenv run streamlit run ...
to run the streamlit
command; having the shell activated means that the streamlit
command will already be on your $PATH.
When you have the shell active, doing this should work instead:
streamlit run iris_eda_app.py
Alternately, you could forego pipenv
and manage your virtualenv directly. Iāve put together a minimal working example of a Streamlit app thatās deployable to Heroku. It uses a plain requirements.txt
file instead of a Pipfile
: https://github.com/tconkling/streamlit_heroku_example
Hi,
Had the same problem. I donāt know if it is windows related but on my ubuntu everything was fine.
Anyway, what you can do is to change the cli.py
filename to __main__.py
.
This worked for me
Hi @Noam, welcome to the Streamlit community!
You shouldnāt need to rename anything, plenty of people are able to deploy on Heroku without needing to modify the source files.
Iām having the same issue. Iām running 3.9 within a conda environment.
Hi @SimonBiggs, Thank you for responding.
I was running 0.71.0 earlier. I removed the environment and re-created it by this command:
conda create -p .\StreamLitEnv python=3.8
Switched to the above environment and then re-installed with this command:
conda install -c conda-forge streamlit
It seemed to work at this point and it installed 0.72 version. I also had SSL_VERIFY set to false. Even though it is bad practice, thatās the only way I could advance.
Out of curiosity, I tried this command:
pipenv install streamlit
This did not work. It failed with CERTIFICATE_VERIFY_FAILED errors.
My questions are:
(Iām new to python, so I apologize for using incorrect terminology). Setting up the system to run streamlit took a lot of time and that is the most frustrating part. I enjoy coding with it.
Thank you for guidance.
Hi @Noam, can you share more information about your environment and how you installed it? Any of the below would be helpful.
$ streamlit version
)$ python --version
)These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.