I’m deploying a machine learning model on share Streamlit through a flask API. Everything worked fine since a few days ago and I don’t know why since this afternoon share streamlit is crashing : I have a ModuleNotFoundError.
Following is the error message I get from the log:
[manager] Python dependencies were installed from /app/openclassrooms-p7/requirements.txt using pip.
[manager] Processed dependencies!
2022-02-01 11:04:05.524 Uncaught app exception
Traceback (most recent call last):
File “/home/appuser/venv/lib/python3.8/site-packages/streamlit/script_runner.py”, line 379, in _run_script
exec(code, module.dict)
File “/app/openclassrooms-p7/app.py”, line 3, in
import shap
ModuleNotFoundError: No module named ‘shap’
However, this library does figure in my requirements.txt (plus I did not change anything yet in my GitHub repo so I don’t understand why it would suddenly not work):
pandas==1.3.5
flask==1.1.2
streamlit==1.3.1
numpy==1.21.2
plotly==5.5.0
scikit-learn==1.0.1
requests==2.27.1
shap==0.40.0
matplotlib==3.5.0
alibi==0.6.2
Thanks a lot for you quick reply. I just deleted the app and redeployed it however I still face the same issue about the module ‘shap’. Would you know what I should do?
I solved this issue by replacing the versions of all the libraries in the requirements.txt file with their latest versions. Also, as I can see in your screenshot, pip is looking for multiple versions of the same library (like cffi). This was also automatically solved when I upgraded the libraries.
Also, I changed the python version from 3.7 to 3.9 in advanced options while deploying.
I all,
I deleted my app and redeployed it choosing python version 3.9. I also amended my requirements.txt file to update the latest versions of each library :
pandas==1.4.0
flask==2.0.2
streamlit==1.5.0
numpy==1.22.1
plotly==5.5.0
scikit-learn==1.0.2
requests==2.27.1
shap==0.40.0
matplotlib==3.5.1
alibi==0.6.4
However I still face the same problem because of ‘shap’. Would you know the cause of this issue? I’m still lost…
Sorry for disturbing you guys…