Skip to content

Add headless OpenCV extras (*-headless)#5169

Open
isaiah-harville wants to merge 2 commits into
PaddlePaddle:release/3.7from
isaiah-harville:headless-opencv-extras
Open

Add headless OpenCV extras (*-headless)#5169
isaiah-harville wants to merge 2 commits into
PaddlePaddle:release/3.7from
isaiah-harville:headless-opencv-extras

Conversation

@isaiah-harville

Copy link
Copy Markdown

Problem

Every PaddleX extra that needs OpenCV depends on opencv-contrib-python (the GUI build), which requires system GUI libraries such as libGL.so.1. In headless environments — servers, containers, CI — those libraries are often absent, so import cv2 fails with ImportError: libGL.so.1: cannot open shared object file. Downstream projects (e.g. PaddleOCR) inherit this pin and cannot produce a clean headless install without post-install surgery.

Change

For every extra that pulls in opencv-contrib-python, auto-generate a -headless counterpart that uses opencv-contrib-python-headless (same version pin, == 4.10.0.84) instead. This is done by a small _to_headless() helper in setup.py, so the variants stay in sync automatically as extras evolve.

New extras: cv-headless, multimodal-headless, ie-headless, trans-headless, ocr-core-headless, ocr-headless, video-headless, serving-headless.

Example:

pip install "paddlex[ocr-core-headless]"   # no libGL / GUI OpenCV

Notes

  • Existing extras are unchanged — fully backward compatible.
  • The headless and GUI builds share the same cv2 API and version, so this is a drop-in for headless deployments.

🤖 Generated with Claude Code

Every extra that depends on the GUI OpenCV build (`opencv-contrib-python`)
now has an auto-generated `-headless` counterpart that uses
`opencv-contrib-python-headless` instead. This lets PaddleX be installed in
headless environments (servers, containers, CI) without the system GUI
libraries (e.g. libGL) that the GUI OpenCV build requires.

Generated variants: cv-headless, multimodal-headless, ie-headless,
trans-headless, ocr-core-headless, ocr-headless, video-headless,
serving-headless. Existing extras are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Jul 1, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants