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

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


RUN apt-get update ##[edited]RUN apt-get install ffmpeg libsm6 libxext6  -y

Add these lines to your Dockerfile


This is a little bit better solution in my opinion. Package python3-opencv includes all system dependencies of OpenCV.

RUN apt-get update && apt-get install -y python3-opencvRUN pip install opencv-python


Even though the above solutions work. But their package sizes are quite big.libGL.so.1 is provided by package libgl1. So the following code is sufficient.

apt-get update && apt-get install libgl1