ModuleNotFoundError on matplotlib when running the app

I am new to Streamlit and today I have deployed my first app but when trying to run the app over the cloud it is throwing below error although this executes successfully in local env. Version I am using is latest i.e. 1.12.2

ModuleNotFoundError: No module named 'matplotlib'
2022-09-06 12:31:44.479 Uncaught app exception
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 556, in _run_script
    exec(code, module.__dict__)
  File "/app/streamlit_covid_dashboard/app.py", line 5, in <module>
    import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'

Hi @mohammad_atif, welcome to the community! :wave: :partying_face:

Could you please share a link to your app’s GitHub repo?

In the meantime, it might help to read:

and:

Your repo needs to include Python dependencies in one of the following dependency files:

requirements.txt
environment.yml
Pipfile
pyproject.toml

Wow it worked. Thanks so much.

1 Like