Skip to content

opencv-python-headless==4.13.0.90 has undeclared dependency on libxcb1 #1198

@Jaimead7

Description

@Jaimead7

Describe the bug

The version 4.13.0.90 of opencv-python-headless fails to import in minimal environments (like a Docker python:slim container) due to an undeclared dependency on the system library libxcb1. This was not a requirement in the previous version (4.12.0.88), making it a regression for headless environments.

To reproduce

  1. Create a Dockerfile with the following content.
FROM python:3.13.8-slim
WORKDIR /app
COPY test.py .
RUN pip install --no-cache-dir opencv-python-headless==4.13.0.90
CMD ["python", "test.py"]
  1. Create a test.py with the following content.
try:
    import cv2
    print('Import succeded')
except Exception as e:
    print(f'Error importing cv2: {e}')
  1. Build and run the container.
docker build -t opencv-test . && docker run opencv-test

Expected behavior

The opencv-python-headless package should import successfully in a minimal environment without graphical system dependencies like libxcb1, as it did in version 4.12.0.88.

Actual behavior

Whith opencv-python-headless==4.13.0.90 the import fails with error.

libxcb.so.1: cannot open shared object file: No such file or directory

Workaround

Installing the system package libxcb1 (apt-get install libxcb1) or pinning the dependency to a previous version (opencv-python-headless<4.13.0.90) resolves the issue.

Environment

  • OpenCV version: 4.13.0.90 (specifically opencv-python-headless)
  • Base image/tested on: python:3.13.8-slim (Official Docker image)
  • OS/Platform: Docker Engine on WSL2 / Windows (but the issue is inherent to the Python package)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions