opencv in Docker or on a server: 'ImportError: libGL.so.1: cannot open shared object file'
@devsingh05▲ 13 net votes
opencv-python links GUI libraries that slim images lack. If you do not need cv2.imshow, install opencv-python-headless instead (and uninstall opencv-python, since having both installed leaves the broken one in place). Otherwise apt-get install -y libgl1 libglib2.0-0 in the Dockerfile. Libraries like ultralytics or easyocr pull in opencv-python, so check pip list after installing them.