ModuleNotFoundError: No module named 'plotly'

Hi,

I am having an issue with a “ModuleNotFoundError: No module named ‘plotly’” when deploying through GitHub.

https://share.streamlit.io/trymaas/master-project/main/visualization.py

I made the requirements.txt file with pipreqs, so not sure how I could have done anything wrong on that front. Any pointers?

Hello @trymaas,

In your app, you should see a black sidebar with all the installation logs for your app. If you reboot your app and read the logs, can you see anything related to plotly?

I tried on my side, I can see:

Collecting matplotlib==1.5.1

  Downloading matplotlib-1.5.1.tar.gz (54.0 MB)

    ERROR: Command errored out with exit status 1:

     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5tii96y5/matplotlib_8af6ac0a2d024d35826310b8dcbfe1e9/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5tii96y5/matplotlib_8af6ac0a2d024d35826310b8dcbfe1e9/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --no-user-cfg egg_info --egg-base /tmp/pip-pip-egg-info-4xbt2eex

         cwd: /tmp/pip-install-5tii96y5/matplotlib_8af6ac0a2d024d35826310b8dcbfe1e9/

    Complete output (68 lines):

    IMPORTANT WARNING:

        pkg-config is not installed.

        matplotlib may not be able to find some of its dependencies

    ============================================================================

    Edit setup.cfg to change the build options

So I actually removed the versions from the requirements.txt (master-project/requirements.txt at main · andfanilo/master-project · GitHub) and now it works https://share.streamlit.io/andfanilo/master-project/main/visualization.py. Maybe matplotlib 1.5.1 is a bit too old?

Cheers,
Fanilo

1 Like

Thanks,

Yeah, seems like I was using some old versions

I have the same error, when I run the script with streamlit run app.py it works fine but when I tried to deploy it with streamlit share it is giving me this error "ModuleNotFoundError: No module named ‘plotly’ ". Can someone please guide me what to do next.

Hi @ira_bajpai, welcome to the Streamlit community!! :tada: :partying_face:

If possible, could you share your repo on here? It might be the case that plotly isn’t included in your requirements.txt.

Best,
Snehan :balloon:

Hi @snehankekre , this is really random, but I just learned how to build dashboards using streamlit from your tutorials on coursera project network. It was really helpful !!! Great tutorial!!

I was trying to deploy the same dashboard, I did added plotly to the requirements however, this is the error that I am now getting " FileNotFoundError: [Errno 2] No such file or directory: ‘C:\Users\DELL\Downloads\tweets.xlsx’ " , I don’t think I have added the file correctly.

here’s the repo: GitHub - irab21/dashboard

Thankyou very much!

1 Like

yes you did that a bit strange.

Just put tweets.xlsx in your folder and set DATA_URL="tweets.xlsx" and it should work.

2 Likes

Thank you @Franky1 , it worked!

1 Like

@ira_bajpai That’s fantastic and wholesome to hear :grinning_face_with_smiling_eyes: I’m glad you found value in my Coursera projects.

Thanks for hopping in with the solution, @Franky1!

Best,
Snehan :balloon:

1 Like

Could you please help to check my streamlit link?
https://share.streamlit.io/hoanguyen55/football_management_steamlit/main.py
I met the same issue as @ira_bajpai but I don’t know where the requirement.txt
stay

Hi @michael_kenshipvip , the requirement file goes in the repository only by the name requirements.txt, you can select add file then either upload or create the file.

1 Like

ok I also have problem with import plotly.express as px. When I delete this line (and others connected) my app works fine, but i want to have some charts! Please help, GitHub - darekpe79/darek
Streamlit link https://share.streamlit.io/darekpe79/darek/main/sportAPI.py

1 Like

Hi @darekpe_pe, welcome to the Streamlit community!! :wave: :partying_face:

It looks like there’s a typo in your requirments.txt filename, that’s causing none of your Python dependencies, including Plotly Express, from being installed on Streamlit Cloud.

Rename requirments.txt to requirements.txt to fix the issue. :grinning_face_with_smiling_eyes:

Happy Streamlit-ing! :balloon:
Snehan

2 Likes

Thank you!

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 563, in _run_script
    exec(code, module.__dict__)File "/app/sales-analysis-project/Web_dashboard.py", line 2, in <module>
    import plotly.express as px  # pip install plotly-express

why why whhhhyyyy

Hi @RaedOkal :wave:

Welcome to the Streamlit forum! Please take a moment to read through our guidelines on how to post an effective question on the forum and, in particular, please share the link to your public Streamlit Cloud app, GitHub repo, and your requirements file.

Hello, I found the same problem here. I have included plotly in my requirements.txt, but it is still not working. Same thing goes to cleantext and wordcloud library. Below is my repo link:
https://github.com/Yung01/Senzer.git

No, you have included it in requirements.txt.txt.

I have tried to named it as requirements.txt, and this is the error I get:

installer returned a non-zero exit code

I have tried to named it as requirements.txt, and this is the error I get:

The file no longer contains an extension: Create requirements · Yung01/Senzer@02c60d1 · GitHub

Rename requirements to requirements.txt.