Hey guys, i have already added my requirements.txt but is not working
im getting this error
2023-09-10 13:13:21.352 Uncaught app exception
Traceback (most recent call last):
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.__dict__)
File "/mount/src/dash_ana/streamlit_app.py", line 2, in <module>
import plotly.express as px
ModuleNotFoundError: No module named 'plotly'
You’re encountering a “ModuleNotFoundError” when trying to run your Streamlit app due to a missing Plotly library. To fix this, first double-check your “requirements.txt” file for any typos or discrepancies in the library name. Ensure it’s accurately listed.
Next, consider creating a virtual environment to isolate dependencies. Activate it and run “pip install -r requirements.txt” to install all required packages.
If deploying to Streamlit Cloud, make sure you’ve followed their setup instructions and specified the correct Python version. Sometimes, simply rebooting or redeploying your app can resolve such issues. These steps should help you resolve the Plotly-related error and get your app up and running. Good luck with your data analysis dashboard project!
No worries! To create a virtual environment, you can follow these steps:
Open your terminal or command prompt.
Navigate to your project directory using the cd command. For example, if your project is in a folder called “my_project,” you’d type: cd my_project
Once you’re inside your project folder, you can create a virtual environment by running: python -m venv venv_name
Replace venv_name with the name you want to give to your virtual environment. It’s common to use names like “env” or “venv.”
After creating the virtual environment, you’ll need to activate it. On Windows, you can do this with: venv_name\Scripts\activate, and on macOS/Linux, it’s: source venv_name/bin/activate
Once activated, your terminal should show the virtual environment’s name in the prompt. Now, you can install your project’s dependencies using pip install -r requirements.txt.
That’s it! Your virtual environment is set up, and you should be able to run your project without module not found errors. Remember to activate the virtual environment each time you work on your project and deactivate it when you’re done with deactivate.
I tried cloning your repo and deployed it using my account and it works flawlessly. Try changing your python version to 3.10.
Deployed app - https://dashana-temp.streamlit.app/
He is trying to deploy from streamlit cloud which automatically assigns a virtual env for deploying. I think he has some issues in setting up the deployment from the streamlit app dashboard. But still one should always use virtual envs for local development.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
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.
Performance cookies
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.
Functional cookies
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.
Targeting cookies
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.