ModuleNotFoundError: No module named 'plotly'; please help

I have already added a requirements.txt file but my app is still not deploying.

Error:
ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)File "/app/traffic-collisions-in-toronto/app.py", line 5, in <module>
    import plotly.express as px

Following is my log:

[     UTC     ] Logs for sanskar220901-traffic-collisions-in-toronto-app-x7jpwe.streamlit.app/
────────────────────────────────────────────────────────────────────────────────────────
[04:16:25] 🖥 Provisioning machine...
[04:16:31] 🎛 Preparing system...
[04:16:37] ⛓ Spinning up manager process...
[04:16:43] 🎈 Inflating balloons...
[04:16:48] 📖 Unpacking Comic Sans RAR files...
[04:16:28] 🚀 Starting up repository: 'traffic-collisions-in-toronto', branch: 'main', main module: 'app.py'
[04:16:28] 🐙 Cloning repository...
[04:16:31] 🐙 Cloning into '/app/traffic-collisions-in-toronto'...
[04:16:31] 🐙 Cloned repository!
[04:16:31] 🐙 Pulling code changes from Github...
[04:16:32] 📦 Processing dependencies...

─────────────────────────────────────── pipenv ─────────────────────────────────────────

/app/traffic-collisions-in-toronto /app/traffic-collisions-in-toronto
Installing dependencies from Pipfile.lock (0a1246)...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
/app/traffic-collisions-in-toronto

────────────────────────────────────────────────────────────────────────────────────────

[04:16:51] 🐍 Python dependencies were installed from /app/traffic-collisions-in-toronto/Pipfile using pipenv.
[04:16:51] 📦 WARN: More than one requirements file detected in the repository. Available options: pipenv /app/traffic-collisions-in-toronto/Pipfile, pip /app/traffic-collisions-in-toronto/requirements.txt. Used: pipenv with /app/traffic-collisions-in-toronto/Pipfile
Check if streamlit is installed
Streamlit is already installed
[04:16:52] 📦 Processed dependencies!

Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.




  For better performance, install the Watchdog module:

  $ pip install watchdog
            
2023-05-11 04:17:14.843 Uncaught app exception
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "/app/traffic-collisions-in-toronto/app.py", line 5, in <module>
    import plotly.express as px
ModuleNotFoundError: No module named 'plotly'

Any help would be much appreciated. Thanks!

Hi @Sanskar_Srivastava, welcome to the forum! :wave:

The error logs state what the issue is:

You have multiple requirements files and Community Cloud uses Pipfile. Streamlit looks at your requirements file’s filename to determine which Python dependency manager to use in the order listed in App dependencies. Streamlit will stop and install the first requirements file found, which in this case is Pipfile.

To resolve the error decide which requirements file you want to use and delete the other.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.