ModuleNotFoundError: No module named 'streamlit_option_menu'

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] :package: 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’

Hi @AliceKoh! Thanks for posting.

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,
I manage to create the requirements.txt but now has another NoModule found. This time, it says NoModule named numpy.

I post my issue under another → Numpy Error - #5 by williamlapa

Hi @AliceKoh,

Have you tried adding numpy to your requirements.txt file?

Best,

Caroline

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

Below is my requirements.txt. Please assist.

Hi AliceKoh,

Can you share the link to the app’s GitHub repo?

Hi Caroline
This is my github link