Add headless OpenCV extras (*-headless)#5169
Open
isaiah-harville wants to merge 2 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every PaddleX extra that needs OpenCV depends on
opencv-contrib-python(the GUI build), which requires system GUI libraries such aslibGL.so.1. In headless environments — servers, containers, CI — those libraries are often absent, soimport cv2fails withImportError: 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-headlesscounterpart that usesopencv-contrib-python-headless(same version pin,== 4.10.0.84) instead. This is done by a small_to_headless()helper insetup.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:
Notes
cv2API and version, so this is a drop-in for headless deployments.🤖 Generated with Claude Code