Skip to content

Commit e57ab0f

Browse files
eoinfennessyclaude
andcommitted
fix: pin opencv-python-headless to the resolved opencv-python version
Capture the exact version from uv pip show before uninstalling, so the headless variant matches what the resolver chose for rapidocr. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fc46665 commit e57ab0f

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

Containerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ COPY distribution/constraints.txt ${APP_ROOT}/constraints.txt
88
COPY distribution/requirements.txt ${APP_ROOT}/requirements.txt
99

1010
# Package docling transitively pulls in opencv-python via rapidocr.
11-
# opencv-python requires libGL.so.1 (absent in UBI). Swap it for the headless variant after install
11+
# opencv-python requires libGL.so.1 (absent in UBI). Swap it for the headless
12+
# variant after install, pinned to the exact version the resolver chose.
1213
RUN uv pip install --constraint ${APP_ROOT}/constraints.txt -r ${APP_ROOT}/requirements.txt \
14+
&& OPENCV_VERSION=$(uv pip show opencv-python 2>/dev/null | awk '/^Version:/{print $2}') \
1315
&& uv pip uninstall opencv-python \
14-
&& uv pip install opencv-python-headless
16+
&& uv pip install --constraint ${APP_ROOT}/constraints.txt "opencv-python-headless==${OPENCV_VERSION}"
1517

1618
COPY distribution/fetch_artifacts.py ${APP_ROOT}/fetch_artifacts.py
1719
COPY --chmod=755 distribution/copy-artifacts.sh ${APP_ROOT}/copy-artifacts.sh

Containerfile.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ COPY distribution/constraints.txt ${APP_ROOT}/constraints.txt
66
COPY distribution/requirements.txt ${APP_ROOT}/requirements.txt
77

88
# Package docling transitively pulls in opencv-python via rapidocr.
9-
# opencv-python requires libGL.so.1 (absent in UBI). Swap it for the headless variant after install
9+
# opencv-python requires libGL.so.1 (absent in UBI). Swap it for the headless
10+
# variant after install, pinned to the exact version the resolver chose.
1011
RUN uv pip install --constraint ${APP_ROOT}/constraints.txt -r ${APP_ROOT}/requirements.txt \
12+
&& OPENCV_VERSION=$(uv pip show opencv-python 2>/dev/null | awk '/^Version:/{print $2}') \
1113
&& uv pip uninstall opencv-python \
12-
&& uv pip install opencv-python-headless
14+
&& uv pip install --constraint ${APP_ROOT}/constraints.txt "opencv-python-headless==${OPENCV_VERSION}"
1315

1416
COPY distribution/fetch_artifacts.py ${APP_ROOT}/fetch_artifacts.py
1517
COPY --chmod=755 distribution/copy-artifacts.sh ${APP_ROOT}/copy-artifacts.sh

0 commit comments

Comments
 (0)