ModuleNotFoundError: This app has encountered an error. import matplotlib.pyplot as plt

Hello,
I’ve tried to solve this problem but still can’t.
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/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script
    exec(code, module.__dict__)File "/mount/src/bike-sharing/Submission/dashboard/dashboard.py", line 2, in <module>
    import matplotlib.pyplot as plt

here is link to the app and github:

streamlit==1.28.2 and python 3.12.0

  • move the requirements file to the root folder
  • cleanup your requirements file, you don’t need most of the libraries :arrow_down:
  • do a reboot of the app

requirements.txt

pandas
matplotlib
seaborn
streamlit
babel

… is all you need