[Streamlit sharing] Importerror: libgl.so.1: cannot open shared object file: no such file or directory opencv error

hello @Franky1,

thank you so much for your help. I still received the same error with the combination below.
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

requirement.txt
streamlit
mediapipe
numpy
opencv-python-headless
streamlit_webrtc

packages.txt
libgl1-mesa-glx
libglib2.0-0

I understand that streamlit cloud probably has an dependencies issues. But I am not sure how to fix this. I have tried chatGPT and also googled other solutions.
Below is my Github Repo for reference

Hi @snehankekre, I applied the solution provided in the above link. Can you please help me with this error.
it was working completely fine locally, but when I deployed this app on streamlit cloud, this error started coming
Error:
File “/mount/src/videotoimage-and-imagetovideo-streamlit-app/pages/Images To Video.py”, line 5, in
import cv2
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

link to repo: GitHub - Manya-15/VideoToImage-and-ImageToVideo-streamlit-app

  • delete the packages.txt file, you probably don’t need it
  • you probably want to use PyDrive2 instead of pydrive (outdated)
  • you better use st.secrets instead of exposing your azure credentials :grimacing:
  • also remove your google credentials from github asap :grimacing:
  • invalidate the exposed credentials for google and azure asap :fire:
  • try the requirements file below :arrow_down:
  • do a reboot of the app

requirements.txt

numpy
streamlit
opencv-python-headless
PyDrive2
azure-storage-blob
1 Like

Thank you for all the instructions, i did all of them
And it worked.
Thanks alot :star_struck:

thanku same error occured in my case now it is resolved