Opencv-python

I’m not able to open opencv in the cloud for some reason this is the error that I already put between packages.txt and requirements.txt
ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)File "/mount/src/open_cv/app.py", line 1, in <module>
    import cv2

Hi @Bruno_Andrade,

Thanks for posting!

Can you share the contents of both your requirements.txt and packages.txt?

Also, check out this previous similar issue for some solutions that might work.

Hey @Bruno_Andrade ,

From my past experiences, opencv works a little weird when trying to deploy it to Streamlit.

A good workaround I found was also installing it’s dependency libraries(e.g. protobuf).

I found this tip on StackOverflow and hope it helps by passing it forward.

pandas<1.2.0
plotly==4.14.3
keras==2.9.0
Pillow==9.0.1
streamlit==1.10.0
tensorflow==2.9.1
protobuf<3.20,>=3.9.2

(this was my previous project requirements.txt file for a project that used cv2)

Hope this helps!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.