How to fix ModuleNotFoundError on streamlit?

I am going to deploy a Anaconda project in Streamlit.

Here are the modules that I have in my project file:

import streamlit as st
import numpy as np
import pandas as pd
import matplotlib as plot
from numpy import genfromtxt
from scipy import stats

I uploaded the python file to github, but when I deployed the app on Streamlit and ran it, I got this 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.7/site-packages/streamlit/scriptrunner/script_runner.py", line 443, in _run_script
    exec(code, module.__dict__)
File "/app/python-training/SimpleFiles/SkinData.py", line 11, in <module>
    import matplotlib.pyplot  as plot

To try to fix this, I made a requirements file with this command:

pip freeze > requirement.txt

and the matplotlib line is among the requirements in the file. Still doesn’t fix the problem. Because when I checked the streamlit log, it was able to get all other modules, except for matplotlib.

How to fix this error?

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