Updating from 4.3.0.36 to 4.3.0.38 should miss system libraries.
import cv2 breaks.
(opencv) root@619f7f2a9b63:/tmp/body# python -c "import cv2"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/conda/envs/opencv/lib/python3.6/site-packages/cv2/__init__.py", line 5, in <module>
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
(opencv) root@619f7f2a9b63:/tmp/body#
Using a fresh python environment inside this container docker run -ti continuumio/miniconda3:4.7.12 /bin/bash:
conda create --name opencv python=3.6 pip=20 --yes
conda activate opencv
It works with previous release
(opencv) root@619f7f2a9b63:/tmp/body# pip install opencv-python==4.3.0.36
Collecting opencv-python==4.3.0.36
Using cached opencv_python-4.3.0.36-cp36-cp36m-manylinux2014_x86_64.whl (43.7 MB)
Collecting numpy>=1.11.3
Downloading numpy-1.19.1-cp36-cp36m-manylinux2010_x86_64.whl (14.5 MB)
|鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 14.5 MB 2.8 MB/s
Installing collected packages: numpy, opencv-python
Successfully installed numpy-1.19.1 opencv-python-4.3.0.36
(opencv) root@619f7f2a9b63:/tmp/body# python -c "import cv2"
(opencv) root@619f7f2a9b63:/tmp/body#
last release breaks:
(opencv) root@619f7f2a9b63:/tmp/body# pip install opencv-python==4.3.0.38
Collecting opencv-python==4.3.0.38
Using cached opencv_python-4.3.0.38-cp36-cp36m-manylinux2014_x86_64.whl (49.3 MB)
Requirement already satisfied: numpy>=1.13.3 in /opt/conda/envs/opencv/lib/python3.6/site-packages (from opencv-python==4.3.0.38) (1.19.1)
Installing collected packages: opencv-python
Attempting uninstall: opencv-python
Found existing installation: opencv-python 4.3.0.36
Uninstalling opencv-python-4.3.0.36:
Successfully uninstalled opencv-python-4.3.0.36
Successfully installed opencv-python-4.3.0.38
(opencv) root@619f7f2a9b63:/tmp/body# python -c "import cv2"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/conda/envs/opencv/lib/python3.6/site-packages/cv2/__init__.py", line 5, in <module>
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
(opencv) root@619f7f2a9b63:/tmp/body#
[x] This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
[x] I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
opencv-pythonSee: https://github.com/skvark/opencv-python/issues/370#issuecomment-671202529
libGL.so is whitelisted by auditwheel. It will not be shipped with the wheels.
I tried to modify the docker file and made some changes in requirements and still couldn't know how to deploy without this error in GCP and locally it is working good. Please let me know if there are any solutions to it. Thanks.
@Yamini-DS I believe you either should depend on opencv-python-headless instead of opencv-python (if your code is the only place where you have a dependency on opencv-python), or ensure that after all python packages installation steps you install opencv-python-headless (to rewrite the package - a hacky option), or install the required GUI stack to the docker image (probably, will take several hundreds of megabytes)
There is someone who solve this problem:
https://stackoverflow.com/questions/63889102/unable-to-run-docker-image-due-to-libgl-error
Most helpful comment
See: https://github.com/skvark/opencv-python/issues/370#issuecomment-671202529
libGL.sois whitelisted byauditwheel. It will not be shipped with the wheels.