-
Notifications
You must be signed in to change notification settings - Fork 846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latest version (4.3.0.38) fails on import - libGL.so.1: cannot open shared object file: No such file or directory #370
Comments
Are you running in headless environment (most likely you are since you are using Docker)? Asking because I have no idea what's in your If you need GUI functions ( |
Thanks, opencv headless does the trick. Yes there's no gui |
This issue has broken all our docker builds. While cc @skvark, because I think you are about to receive many message about this, perhaps something can be done with the versions. |
Thanks for the suggestion and I understand your frustration. The packages follow OpenCV versioning and I'm not planning to change that. I don't guarantee compatibility between different releases (nor does OpenCV afaik). The latest release was made to fix major problem specifically with the GUI methods. The headless packages are same as in previous release. Therefore this issue affects mostly server environments where |
I realize that the maintainers are correctly following manylinux recommendations, but it looks like, in reality, common docker images such as |
You should use the |
That's not really a viable option given that pip does not support 'near equivalent' package requirements. A real-world example:
This is hinted at by CoenraadS above.
|
Minimal and reproducible example: $ docker container run -it --rm --entrypoint=bash python:3.9
root@79a5d5e0f6e1:/# echo 'opencv-python' > requirements.txt
root@79a5d5e0f6e1:/# python3 -m pip install opencv-python-headless
Collecting opencv-python-headless
Downloading opencv_python_headless-4.5.3.56-cp39-cp39-manylinux2014_x86_64.whl (37.1 MB)
|████████████████████████████████| 37.1 MB 7.0 MB/s
Collecting numpy>=1.19.3
Downloading numpy-1.21.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.8 MB)
|████████████████████████████████| 15.8 MB 6.3 MB/s
Installing collected packages: numpy, opencv-python-headless
Successfully installed numpy-1.21.2 opencv-python-headless-4.5.3.56
root@79a5d5e0f6e1:/# python3 -m pip install -r requirements.txt
Collecting opencv-python
Downloading opencv_python-4.5.3.56-cp39-cp39-manylinux2014_x86_64.whl (49.9 MB)
|████████████████████████████████| 49.9 MB 6.5 MB/s
Requirement already satisfied: numpy>=1.19.3 in /usr/local/lib/python3.9/site-packages (from opencv-python->-r requirements.txt (line 1)) (1.21.2)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.5.3.56
root@79a5d5e0f6e1:/# python3 -c 'import cv2'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.9/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 |
If you need to use |
for me the following solved the isse on azure web app : opencv-python-headless==4.5.3.56 in place of opencv-python==4.5.4.60 |
RUN pip uninstall opencv-python -y |
Expected behaviour
Since the update last night to version 4.3.0.38, our builds are breaking. On 4.3.0.36 all runs fine
Actual behaviour
On python:3.8 docker images (and also python:3.7), we are getting this
Steps to reproduce
Dockerfile
requirements.txt
test.py
Run
docker build -t opencv-test:latest .
And then
docker run opencv-test:latest
You will get the error written above.
If the version is set to 4.3.0.38 you will get:
success
Issue submission checklist
opencv-python
The text was updated successfully, but these errors were encountered: