OpenCV libGL/libgthread dependency errors on Streamlit Community Cloud

Hi Streamlit team,

I experienced repeated deployment failures with a Streamlit Community Cloud app using YOLOv8 and OpenCV.

Initially, the deployment failed with:

E: Release file for http://deb.debian.org/debian-security/dists/bullseye-security/InRelease is expired

This occurred during packages.txt installation and prevented the application from starting.

After recreating the app, I encountered:

ImportError: libGL.so.1: cannot open shared object file

I added libgl1 to packages.txt, after which the error changed to:

ImportError: libgthread-2.0.so.0: cannot open shared object file

I then had to add the additional required Linux dependency before the application finally started.

My Python requirements already specified:

opencv-python-headless==4.12.0.88

The application itself was working correctly; the main difficulty was identifying and resolving the underlying system-library dependencies and the Community Cloud APT issue.

I understand that native dependencies such as OpenCV can require system packages, but the deployment experience was quite difficult to troubleshoot, especially when the initial failure was caused by an expired Debian repository.

It would be helpful if the Community Cloud environment could provide more consistent native-library support for packages such as OpenCV, or clearer guidance on the expected system dependencies.

Thanks.

Welcome to the Streamlit community and thank you for your detailed feedback! :partying_face: You’re absolutely right—deploying apps with native dependencies like OpenCV on Streamlit Community Cloud can be tricky, especially when system-level libraries are missing or when the underlying Debian repositories have issues. The errors you encountered (expired APT repo, missing libGL.so.1, and libgthread-2.0.so.0) are common pain points for users deploying computer vision apps, and troubleshooting them often requires adding the right packages (like libgl1 and sometimes libglib2.0-0) to packages.txt, as you discovered.

The official docs recommend using opencv-python-headless in requirements.txt and adding libgl1 to packages.txt for OpenCV support, but dependencies can change if other libraries (like imageai or mediapipe) are involved, sometimes requiring additional system packages like libglib2.0-0. The expired Debian repo issue is a platform-level problem that Streamlit periodically resolves, but it can block all apt installs until fixed. For more info, see the Streamlit docs on apt dependencies and OpenCV deployment issues. Sharing your experience helps the team and community improve guidance and platform reliability—thanks for raising it! If you have a minimal reproducible example or a list of all the system packages you needed, sharing that in the forums can help others too.

Sources: