Skip to content

ImportError after upgrading from 4.12.0.88 to 4.13.0.90 on linux/aarch64, missing libxcb.so.1 #28438

@manuel-koch

Description

@manuel-koch

System Information

Docker container linux/aarch64, docker host MacOS arm64
Docker base image: python:3.13-slim-bookworm

Detailed description

While trying to upgrade from 4.12.0.88 to 4.13.0.90 I get strange import errors when trying to use cv2 python package.
I.e. my application within the docker image worked with opencv-python-headless==4.12.0.88, but crashed on startup with opencv-python-headless==4.13.0.90.

Is there any binary dependency that needs to be install for 4.13.0.90 that was not necessary for 4.12.0.88 ?

Using the following simple Dockerfile:

FROM python:3.13-slim-bookworm
WORKDIR /opt/app
RUN uname -a
RUN pip3 --version ; pip3 install opencv-python-headless==4.13.0.90
RUN python --version ; python3 -c "import cv2 as cv"

It fails during build of a native docker image on MacOS with ImportError:

$ docker build --progress plain  -f Dockerfile-bug .
#0 building with "desktop-linux" instance using docker driver

#1 [internal] load build definition from Dockerfile-bug
#1 transferring dockerfile: 224B done
#1 DONE 0.0s

#2 [auth] library/python:pull token for registry-1.docker.io
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/python:3.13-slim-bookworm
#3 DONE 1.0s

#4 [internal] load .dockerignore
#4 transferring context: 142B done
#4 DONE 0.0s

#5 [1/5] FROM docker.io/library/python:3.13-slim-bookworm@sha256:97e9392d12279f8c180eb80f0c7c0f3dfe5650f0f2573f7ad770aea58f75ed12
#5 resolve docker.io/library/python:3.13-slim-bookworm@sha256:97e9392d12279f8c180eb80f0c7c0f3dfe5650f0f2573f7ad770aea58f75ed12 done
#5 CACHED

#6 [2/5] WORKDIR /opt/app
#6 DONE 0.0s

#7 [3/5] RUN uname -a
#7 0.150 Linux buildkitsandbox 6.12.54-linuxkit #1 SMP Fri Nov 21 10:33:45 UTC 2025 aarch64 GNU/Linux
#7 DONE 0.2s

#8 [4/5] RUN pip3 --version ; pip3 install opencv-python-headless==4.13.0.90
#8 0.792 pip 25.3 from /usr/local/lib/python3.13/site-packages/pip (python 3.13)
#8 1.492 Collecting opencv-python-headless==4.13.0.90
#8 1.689   Downloading opencv_python_headless-4.13.0.90-cp37-abi3-manylinux_2_28_aarch64.whl.metadata (19 kB)
#8 1.865 Collecting numpy>=2 (from opencv-python-headless==4.13.0.90)
#8 1.895   Downloading numpy-2.4.1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.metadata (6.6 kB)
#8 1.934 Downloading opencv_python_headless-4.13.0.90-cp37-abi3-manylinux_2_28_aarch64.whl (36.6 MB)
#8 4.975    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 36.6/36.6 MB 12.2 MB/s  0:00:03
#8 5.016 Downloading numpy-2.4.1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (14.4 MB)
#8 6.163    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.4/14.4 MB 12.4 MB/s  0:00:01
#8 6.211 Installing collected packages: numpy, opencv-python-headless
#8 8.116 
#8 8.117 Successfully installed numpy-2.4.1 opencv-python-headless-4.13.0.90
#8 8.117 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
#8 DONE 8.6s

#9 [5/5] RUN python --version ; python3 -c "import cv2 as cv"
#9 0.158 Python 3.13.11
#9 0.235 Traceback (most recent call last):
#9 0.235   File "<string>", line 1, in <module>
#9 0.235     import cv2 as cv
#9 0.235   File "/usr/local/lib/python3.13/site-packages/cv2/__init__.py", line 181, in <module>
#9 0.235     bootstrap()
#9 0.235     ~~~~~~~~~^^
#9 0.235   File "/usr/local/lib/python3.13/site-packages/cv2/__init__.py", line 153, in bootstrap
#9 0.235     native_module = importlib.import_module("cv2")
#9 0.235   File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
#9 0.235     return _bootstrap._gcd_import(name[level:], package, level)
#9 0.235            ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#9 0.235 ImportError: libxcb.so.1: cannot open shared object file: No such file or directory
#9 ERROR: process "/bin/sh -c python --version ; python3 -c \"import cv2 as cv\"" did not complete successfully: exit code: 1
------
 > [5/5] RUN python --version ; python3 -c "import cv2 as cv":
0.235     import cv2 as cv
0.235   File "/usr/local/lib/python3.13/site-packages/cv2/__init__.py", line 181, in <module>
0.235     bootstrap()
0.235     ~~~~~~~~~^^
0.235   File "/usr/local/lib/python3.13/site-packages/cv2/__init__.py", line 153, in bootstrap
0.235     native_module = importlib.import_module("cv2")
0.235   File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
0.235     return _bootstrap._gcd_import(name[level:], package, level)
0.235            ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.235 ImportError: libxcb.so.1: cannot open shared object file: No such file or directory
------
Dockerfile-bug:5
--------------------
   3 |     RUN uname -a
   4 |     RUN pip3 --version ; pip3 install opencv-python-headless==4.13.0.90
   5 | >>> RUN python --version ; python3 -c "import cv2 as cv"
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c python --version ; python3 -c \"import cv2 as cv\"" did not complete successfully: exit code: 1

Steps to reproduce

  • build sample native docker image on MacOS arm64
  • install opencv-python-headless==4.13.0.90
  • import of cv2 fails

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions