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 565, in _run_script
exec(code, module.__dict__)File "/mount/src/heath_case_prediction/streamlit_app.py", line 8, in <module>
model = pickle.load(open(model_path, 'rb'))
The ModuleNotFoundError is typically encountered when the deployed app is missing dependent libraries. To solve this, you can add libraries used by the app (the import statements in your app.py file) in the requirements.txt file.
for the app.py file, this are what are imported
import pickle
import streamlit as st
import numpy as np
import os
but for the requirement file i only have
numpy==1.24.2
streamlit==1.18.1
is an ML model built using Scikit-learn and thus it would require scikit-learn to be added to requirements.txt file along with the corresponding import statement.