Skip to content

opencv-python-headless requires x11 #208

@gldraphael

Description

@gldraphael

Expected behaviour

import cv2 should not throw if libsm6, libxrender-dev, and libxext6 are not installed when using opencv-python-headless.

Actual behaviour

import cv2 throws.

Steps to reproduce

  1. Create the following Dockerfile:
    FROM python:3.7-slim-stretch
    
    # Print architecture
    dpkg --print-architecture
    
    # Install OpenCV's runtime dependencies
    RUN apt-get update
    RUN apt-get -y install libglib2.0-0
    # Uncomment the unfollowing lines, to get it to work
    # RUN apt-get -y install libsm6 \
    #     libxrender-dev \
    #     libxext6
    
    # Install OpenCV headless using pip
    RUN pip install opencv-python-headless==4.1.0.25
    
    # Ensure that opencv and its dependencies
    # are correctly installed
    RUN python -c 'import cv2'
  2. Build the image, and import cv2 will throw:
    docker build --rm -t opencv-headless-exp:latest .
  3. Uncomment installation of libsm6, libxrender-dev, and libxext6 and import cv2 won't throw anymore.
  • OS: Debian stretch slim
  • Architecture: amd64
  • opencv-python-headless version: 4.1.0.25

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions