"ImportError: libGL.so.1: cannot open shared object file: No such file or directory - Streamlit Cloud Deployment"

Hello Streamlit community,

I’m encountering an issue when deploying my Streamlit app on Streamlit Cloud. I’m receiving the following error:

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

This error occurs in my deepfake_detection.py script, specifically when trying to import the cv2 module. I understand that this is likely related to a missing dependency or library on the deployment environment.

Here’s what I’ve tried so far:

  • Ensured that OpenCV (cv2) is included in my requirements.txt file.
  • Confirmed that the necessary dependencies are installed in my local environment.

However, despite these efforts, the error persists. I believe it may be related to a missing system library (libGL.so.1).

Could someone please provide guidance on how to resolve this issue? Specifically, how can I ensure that the necessary system libraries are available when deploying my Streamlit app on Streamlit Cloud?

Any help or suggestions would be greatly appreciated. Thank you!

Additional Information:

  • Streamlit Version: [1.32.0]
  • Python Version: [3.9]
  • Operating System: [Windows]
  • Dependencies: [dependencies satisfied]
  • Deployment Method: [streamlit cloud community by using github repo]

Hi @Ragavan_B . First of all welcome to the community. The error is related to the cv2. Have you rechecked the dependencie of cv2 in requirement.txt?? I mean you need to mention it as opencv-python-headless or opencv-contrib-python-headless. Remember to reboot the app once your updated your requirements.txt file . Hope it works.

Happy Streamlit-ing :balloon: