Skip to content

override opencv-headless install#2093

Open
edknv wants to merge 2 commits into
NVIDIA:mainfrom
edknv:edwardk/pip-dep-opencv
Open

override opencv-headless install#2093
edknv wants to merge 2 commits into
NVIDIA:mainfrom
edknv:edwardk/pip-dep-opencv

Conversation

@edknv
Copy link
Copy Markdown
Collaborator

@edknv edknv commented May 22, 2026

Description

When you install .[local] from scratch, pip/uv end up resolving both opencv-python and opencv-python-headless. Neither one is declared by us, but both come in probably through the nemotron wheels. Those two packages both install to the same cv2/ directory on disk, so they stomp on each other.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.
  • If adjusting docker-compose.yaml environment variables have you ensured those are mimicked in the Helm values.yaml file.

@edknv edknv requested review from a team as code owners May 22, 2026 04:24
@edknv edknv requested a review from nkmcalli May 22, 2026 04:25
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 22, 2026

Greptile Summary

This PR fixes a packaging conflict where nemotron wheels transitively pull in both opencv-python and opencv-python-headless, which collide in the same cv2/ directory on disk. It resolves the conflict by suppressing opencv-python via a uv override-dependencies platform-never marker and explicitly pinning opencv-python-headless>=4.8.0 in the local extras.

  • Adds "opencv-python ; sys_platform == 'never'" to [tool.uv] override-dependencies, which makes uv treat the package as unsatisfiable on all real platforms, effectively removing it from the resolved environment.
  • Adds "opencv-python-headless>=4.8.0" to the local optional-dependencies group so the cv2 module is still available for ML workloads running in headless server environments.

Confidence Score: 5/5

Safe to merge — the two-line dependency change is well-scoped and resolves a real installation conflict without removing any functionality.

No GUI-only cv2 calls exist in the codebase (cv2.imshow, cv2.waitKey, etc. return zero matches), so replacing opencv-python with opencv-python-headless carries no functional regression. The sys_platform == 'never' override pattern is documented and the version floor >=4.8.0 is reasonable for an ML pipeline. Previous reviewer concerns about missing comments and version constraints have been addressed in this revision.

No files require special attention.

Important Files Changed

Filename Overview
nemo_retriever/pyproject.toml Adds opencv-python ; sys_platform == 'never' override to suppress the conflicting transitive opencv-python package, and explicitly declares opencv-python-headless>=4.8.0 in the local extras so cv2 functionality is still available without the GUI variant stomping the headless install.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["pip/uv install .[local]"] --> B["Resolve dependencies"]
    B --> C["nemotron wheels"]
    C --> D["transitive: opencv-python"]
    C --> E["transitive: opencv-python-headless"]
    D -->|"override: sys_platform == 'never'"| F["Suppressed — never installed"]
    E --> G["cv2/ directory"]
    H["explicit: opencv-python-headless>=4.8.0"] --> G
    G --> I["Clean cv2 install — no collision"]
Loading

Reviews (2): Last reviewed commit: "add uv.lock" | Re-trigger Greptile

Comment thread nemo_retriever/pyproject.toml
Comment thread nemo_retriever/pyproject.toml Outdated
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.

1 participant