HI I receive this error during deployment. I am confused as I have import option_menu. In my conda also shows I have option_menu. I can run my whole apps before deployment. Please assist. Thanks.
ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks.
[05:06:03] Processed dependencies!
2022-08-03 05:07:22.324 Uncaught app exception
Traceback (most recent call last):
File â/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.pyâ, line 557, in _run_script
exec(code, module.dict)
File âstreamlit_app.pyâ, line 4, in
from streamlit_option_menu import option_menu
ModuleNotFoundError: No module named âstreamlit_option_menuâ
I am confused as I have import option_menu. In my conda also shows I have option_menu.
It looks like youâre using a Streamlit component called streamlit_option_menu. The error youâre seeing likely indicates that you need to add âstreamlit_option_menuâ to your requirements file (requirements.txt or environment.yml)
Hi Caroline,
Yes I tried. I tried the below all but not working:
a) input numpy only without version at requirements.txt
b) input numpy with version 1.21.4 (my original version)
c) input numpy with version 1.21.5 (after I reinstall when no such module)
d) Currently all my app only use panda (open file, convert dictionary to dataframe, save dataframe, pycaret for model and if-elif statement. I do not use numpy. So In my apps, I tried no import numpy as np.
e) I include import numpy as np for my apps that uses pandas still keepon prompting no numpyâŚ
f) delete the streamlit deployment and recreate with version 3.7 and 3.8
Hi Caroline,
I re-do the requirements.text using pipreqs utf-8 which it auto generated not manually done by me. Still it fails to deploy the apps with the same error message ModuleNotFoundError: No module named ânumpyâ.
By the way, I do notice there is this error message Ă python setup.py egg_info did not run successfully before numpy error message. Could there be issue with setuptools? How can I check?
. Is there anything that I can delete or add to fix the issue? Really appreciate if you can assist as I put in a lot of effort into the apps which is my first data science apps. Thanks.
Marked as solved because the ModuleNotFoundError: No module named âstreamlit_option_menuâ was fixed by including streamlit-option-menu in requirements.txt.
Hi snehan,
I did 2 things â change requirements.txt to the 4lines, delete and redeploy using 3.8. This time the error message is No module named pycaret. Have I missed out something?
Unfortunately, the version of pycaret that is installed in Python 3.8 does not contain the pycaret.internal.preprocess method. Youâd have to either retrain the model with this older version of pycaret or try deploying the app on an alternate platform.
It seems like Pycaretâs dependency resolution (with the newest versions) doesnât work well on Streamlit Cloud.
May I know if I use SKlearn instead of pycaret, will the model face problem? I have never use SKLearn before and not sure if I know how to use but if it works, I will try it out.
Iâm afraid thatâs beyond the scope of this thread and a more general ML tooling question. Itâs unlikely the pickle files are interoperable between sklearn and pycaret.
Based on your use-case, you could try creating your ML model purely with scikit-learn. They have one of the best docs out there with code examples covering a wide variety of applications:
If nothing, it would a good learning exercise. That said, if you urgently need to have your app up and running, try seeing if pycaret and your dependencies install without issues on Spaces - Hugging Face
If they donât, itâs worth going down the sklearn route.
Hi snehan,
Thanks for taking time to assist. Glad that I manage to pick up scikit-learn and successfully deploy my first machine learning app. Though scikit is a bit antique not as glamor as Pycaret but as antique as it is, it works. I am so happy. Below is the link.