# How to fix ImportError: libGL.so.1: cannot open shared object file: No such file or directory

You are on a headless box and opencv-python wants GUI system libs. Two fixes: install the lib (`sudo apt-get install libgl1`, often plus `libglib2.0-0`), or switch to the headless wheel: `pip install opencv-python-headless`. The headless wheel is the right call for servers and Docker; it has no GUI deps at all.

## The exact error

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

## Fix it

1. Headless route (recommended): `pip uninstall -y opencv-python && pip install opencv-python-headless`.
   Expected: `import cv2` works

2. Or install system libs: `sudo apt-get install -y libgl1 libglib2.0-0`.
   Expected: `import cv2` works with the GUI wheel

3. Docker: add the apt line to your Dockerfile before pip install.
   Expected: container imports cv2 cleanly

## When this applies

`import cv2` fails on libGL.so.1 (or libgthread) in Docker/CI/headless Linux

## When this does NOT apply

you actually need cv2.imshow (then install the libs, do not go headless)

## Versions

Linux Docker / headless servers, opencv-python

## Why it happens

opencv-python links Qt/OpenGL system libraries that slim images do not ship.

## Edge cases

Never install both opencv-python and opencv-python-headless; they conflict.
