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…
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.