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 @madras,
Welcome to the streamlit forum . Are you running streamlit 0.72.0?
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.