Docker 환경에서 ImportError: libGL.so.1: cannot open shared object file: No such file or directory 발생 시 해결 방법
|2023. 5. 13. 14:26
문제 상황
opencv
를 포함한 Docker 이미지를 만들 때 cv2
의 의존 패키지가 없을 때 발생한다.
해결 방법
의존 패키지를 추가로 설치하거나 opencv-python-headless
과 같이 애초에 서버용으로 제작된 라이브러리를 활용하자.
opencv-python-headless
사용하기
RUN pip3 install opencv-python-headless
- 의존 패키지 직접 설치하기
RUN apt-get update && apt-get install libgl1-mesa-glx -y
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
참고
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
I am trying to run cv2, but when I try to import it, I get the following error: ImportError: libGL.so.1: cannot open shared object file: No such file or directory The suggested solution online is
stackoverflow.com