The code works perfectly fine on my local. However, when deploying on Streamlit I got caught ModuleNotFoundError. I try different things but still cannot load the modules.
Traceback (most recent call last):
File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.__dict__)
File "/mount/src/predictive-app/main/app/app.py", line 14, in <module>
from predict import make_prediction, preprocess_data
File "/mount/src/predictive-app/main/app/predict.py", line 5, in <module>
from main.model.model_loader import load_models
ModuleNotFoundError: No module named 'main'
Streamlit Community Cloud runs Python in the root of your repo, so any file paths that youβre specifying in the app may need to be updated when youβre deploying the app vs. running it locally. It looks like someone ran into a super similar issue with a .joblib file in this thread and resolved it by updating the file path.