Import cv2 issues

  1. The app link: https://fypslr-dii96sciuwd3zbgwspyhws.streamlit.app/
  2. Github: GitHub - wayyn3/fypSLR
  3. Error message: ```
    2024-01-01 14:30:13.907 Uncaught app exception

Traceback (most recent call last):


File “/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 534, in _run_script


exec(code, module.__dict__)

File “/mount/src/fypslr/app.py”, line 2, in


import cv2

ImportError: libGL.so.1: cannot open shared object file: No such file or directory


2024-01-01 14:30:14.031 503 GET /script-health-check (10.13.94.21) 127.36ms

4. Streamlit version: streamlit==1.28.2
python version: opencv-contrib-python==4.8.1.78
opencv-python==4.8.1.78
opencv-python-headless==4.9.0.80

i have tried with the opencv-python-headless and packages.txt still not working, helppp

Just use opencv-contrib-python-headless. Dont mention any version and also remove packages.txt. No need of that. Trust me it will works. Because I have deployed my application with same package which i had mentioned in my requirements.txt file

Happy Streamlit-ing :balloon:

Thanks, but I still getting the same error after trying opencv-contrib-python-headless with and without the version :face_holding_back_tears:

Once check the following GitHub repository
https://github.com/chakka-guna-sekhar-venkata-chennaiah/vitap-sem1-python-capstone

Once suggestion that to use python 3.10 while deploying your app.

The github repository is 404 not found. My python version is Python 3.11.7 should i download Python 3.10?

Yes. It is working with 3.10

I have uninstall my python 3.11 and using python 3.10.0 but still not work for me :disappointed_relieved:

If possible shall I deploy that one?

hii, thanks, my streamlit app finally works! I delete the deploying app and redeploy by referring to this Import cv2 error : module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline' · Issue #5315 · streamlit/streamlit · GitHub .