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

You receive the error ImportError libGL.so.1 cannot open shared object file No such file or directory when using OpenCV in your app deployed on Streamlit Community Cloud.

If you use OpenCV in your app, include opencv-python-headless in your requirements file on Streamlit Community Cloud in place of opencv_contrib_python and opencv-python.

If opencv-python is a required (non-optional) dependency of your app or a dependency of a library used in your app, the above solution is not applicable. Instead, you can use the following solution:

Create a packages.txt file in your repo with the following line to install the apt-get dependency libgl:

libgl1
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.

Was this page helpful?

editEdit this page on GitHub