Opencv-python: aarch64 wheel depends on, but does not include libGL.so.1

Created on 8 Apr 2021  路  3Comments  路  Source: opencv/opencv-python

Expected behaviour

When installing opencv, via pip, the downloaded wheel should contain all binary dependencies.

Actual behaviour

python3 -m pip install --no-cache-dir opencv-python
  shell: sh -e {0}
Collecting opencv-python
  Downloading opencv_python-4.5.1.48-cp38-cp38-manylinux2014_aarch64.whl (34.5 MB)
Collecting numpy>=1.19.3
  Downloading numpy-1.20.2-cp38-cp38-manylinux2014_aarch64.whl (12.7 MB)
Installing collected packages: numpy, opencv-python
Successfully installed numpy-1.20.2 opencv-python-4.5.1.48
 echo "import cv2" | python3
  shell: sh -e {0}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/dist-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
Error: Process completed with exit code 1.

Steps to reproduce

  1. Start an aarch64 system with Ubuntu 20.04, Centos 8, or Amazon Linux 2. Install python3 and pip.
  2. python3 -m pip install opencv-python
  3. echo "import cv2" | python3

This can be fixed by adding running auditwheel on the binary wheel after build completion to make in compliant with the spec. This will bundle any dependencies in the wheel and verify that it links against the max versions of system libraries like glibc in order to be broadly compatible.

Issue submission checklist
  • [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)


  • [x] The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")

  • [x] I'm using the latest version of opencv-python

All 3 comments

Auditwheel is already used. Manylinux policy states that libGL.so.1 should not be included (https://github.com/pypa/auditwheel/blob/master/auditwheel/policy/policy.json#L108).

This is stated also by PEP 599: https://www.python.org/dev/peps/pep-0599/#id20

To be exact, manylinux wheels should not include these binaries:

The wheel's binary executables or shared objects may not link against externally-provided libraries except those in the following list:

libgcc_s.so.1
libstdc++.so.6
libm.so.6
libdl.so.2
librt.so.1
libc.so.6
libnsl.so.1
libutil.so.1
libpthread.so.0
libresolv.so.2
libX11.so.6
libXext.so.6
libXrender.so.1
libICE.so.6
libSM.so.6
libGL.so.1
libgobject-2.0.so.0
libgthread-2.0.so.0
libglib-2.0.so.0

Got it. Thanks for posting a link to the spec.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

milansoliya4210 picture milansoliya4210  路  5Comments

lgvaz picture lgvaz  路  3Comments

danielgordon10 picture danielgordon10  路  7Comments

ghost picture ghost  路  4Comments

askerlee picture askerlee  路  5Comments