ModuleNotFoundError: No module named 'plotly'

I have renamed it, but I’m still getting error:

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/senzer/pages/3_Dashboard.py", line 4, in <module>
    import plotly.express as px

The file is still requirements. It has not been renamed to include the .txt extension.

It shows error:

Collecting streamlit

  Downloading streamlit-1.17.0-py2.py3-none-any.whl (9.3 MB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.3/9.3 MB 139.9 MB/s eta 0:00:00[2023-01-19 12:15:56.201637] 

ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)

ERROR: No matching distribution found for PIL

WARNING: You are using pip version 22.0.3; however, version 22.3.1 is available.

You should consider upgrading via the '/home/appuser/venv/bin/python -m pip install --upgrade pip' command.

Checking if Streamlit is installed


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


[12:15:56] ❗️ installer returned a non-zero exit code

[12:15:56] ❗️ Error during processing dependencies! Please fix the error and push an update, or try restarting the app.

It seems like it cannot read the requirement file at all.

I guess you want pillow instead of PIL.

You’ve included an incorrect package name. The package is pillow, not PIL. While you import it as PIL, the package name on PyPI is pillow. You also want to remove pickle as it is part of the Python Standard Library:

Thank you so much!
But now I got the other error:

Collecting clean-text

  Downloading clean_text-0.6.0-py3-none-any.whl (11 kB)

ERROR: Could not find a version that satisfies the requirement pickle (from versions: none)

Is this error about clean-text having wrong package name or the pickle having wrong package name?

It is about pickle not being found in pypi because it is part of the standard library.

So does it means that I do not need to include pickle in the requirements.txt?

Yes.

Hi, folks! I need help as well :smiling_face_with_tear:
I’m still getting [ModuleNotFoundError: No module named ‘plotly’] errors although I’ve already included it in the requirements.txt file!
Here’s a link to my repository: https://github.com/
It’s where I followed the step-by-step guide of this great tutorial from Youtube https://youtu.be/3egaMfE9388
It works just fine on the local site but when I try to deploy it via streamlit cloud, here’s what it comes out from the log:

[11:14:56] 🐍 Python dependencies were installed from /app/myapp124/requirements.txt using pip.
[11:14:56] 📦 Processed dependencies!
  Stopping...

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




[11:14:59] 🔄 Updated app!
[11:33:28] 🐙 Pulling code changes from Github...
[11:33:29] 📦 Processing dependencies...
[11:33:29] 📦 Processed dependencies!
[11:33:31] 🔄 Updated app!
[12:41:32] 🐙 Pulling code changes from Github...
2023-01-24 12:41:33.306 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/myapp124/main.py", line 3, in <module>
    import plotly.graph_objects as go
ModuleNotFoundError: No module named 'plotly'
[12:41:43] 🐙 Pulling code changes from Github...
[12:41:54] 🐙 Pulling code changes from Github...
[12:42:05] 🐙 Pulling code changes from Github...
2023-01-24 12:42:09.225 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/myapp124/main.py", line 3, in <module>
    import plotly.graph_objects as go
ModuleNotFoundError: No module named 'plotly'
[12:42:16] 🐙 Pulling code changes from Github...
[12:42:27] ❗️ Updating the app files has failed: git pull, cmd: sudo -u appuser GIT_SSH_COMMAND='ssh -i /home/appuser/.ssh/id_github -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o "LogLevel ERROR"' git fetch origin && sudo -u appuser git reset --hard origin/main: error: exit status 128: error: unable to create file .streamlit/config.toml: Permission denied
fatal: Could not reset index file to revision 'origin/main'.
[12:43:29] 🐙 Pulling code changes from Github...
2023-01-24 12:43:38.284 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/myapp124/main.py", line 3, in <module>
    import plotly.graph_objects as go
ModuleNotFoundError: No module named 'plotly'
2023-01-24 12:43:40.870 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/myapp124/main.py", line 3, in <module>
    import plotly.graph_objects as go
ModuleNotFoundError: No module named 'plotly'

It seems to have repeated several times before it crashed!

Did you do a manual reboot after changing your requirements file? Can you try that and share what your console says from that clean starting point?

1 Like

Thank you for your speedy response!
It now works~ :smiling_face_with_three_hearts:
You have a good one

Hi, I have the ModuleNotFoundError: No module named ‘plotly’ error

Traceback:

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/prova_stream_app/titanic_st.py", line 10, in <module>
    import plotly.express as px

this is the link of the app https://provastreamapp-k3f7vljlhi.streamlit.app/
and this one is the github link https://github.com/Adri1bo/prova_stream_app

Please help!

i have included everything in the requirements in the github then also it is showing the error:

 import plotly.express as px
ModuleNotFoundError: No module named 'plotly'

Please share a link to your public github repo.

Hello,
I need help for the same reason when using:
import plotly.express as px

On local, everything work, I don’t understand. Here my git link: GitHub - Bilouu93/Ei_impact

Thank you very much for your help!

You need only plotly in requirements.txt, you can delete the rest.

Go to https://share.streamlit.io/ and click the three dots of your app, there click “reboot” and it should work.

Hello,

I also meet the same problem when using:

On local, everything worked.

Here is the link of the app https://demo-montagesimulation-nctmxaqrbsqi6coyapkeju.streamlit.app/Ergebnisse
and this is the github link GitHub - Carpediem1-1/Montagesimulation

Thank you for your help ahead

Typo: requirements.txt