Skip to content

build: exclude opencv-python-headless from shipped container - #3339

Merged
terrykong merged 5 commits into
mainfrom
block-opencv-headless
Jul 25, 2026
Merged

build: exclude opencv-python-headless from shipped container#3339
terrykong merged 5 commits into
mainfrom
block-opencv-headless

Conversation

@kajalj22

@kajalj22 kajalj22 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • opencv-python-headless bundles FFmpeg codec libs (libavcodec, libavformat, etc.) in opencv_python_headless.libs/. Its included patent-encumbered codecs (H.264, H.265, AAC) may incur royalties when distributed in a shipped container.
  • Mark it sys_platform == 'never' in [tool.uv.override-dependencies], keeping the >=5.0.0 CVE version pin, so it is never baked into the image.
  • Add it to tools/install_audio_deps.sh so it is installed at test/runtime alongside torchaudio and torchcodec.

vllm compatibility: vllm defaults to opencv for video IO but wraps all three backends (cv2, av, torchcodec) in a try/except PlaceholderModule pattern — if cv2 is absent it falls back gracefully to torchcodec, which is already installed by this script. NeMo-RL's data loading explicitly uses backend="torchcodec" in multimodal_utils.py and processors.py.

Closes #3254

Test plan

  • Nightly suite in progress - Pipeline: 59459207

🤖 Generated with Claude Code

opencv-python-headless bundles FFmpeg codec libs (libavcodec, libavformat,
etc.) whose included patent-encumbered codecs (H.264, H.265, AAC) may incur
royalties when distributed in a shipped container.

Mark it as sys_platform == 'never' in override-dependencies (keeping the
>=5.0.0 CVE pin) so it is never baked into the image. Add it to
tools/install_audio_deps.sh so it is installed at test/runtime alongside
torchaudio and torchcodec. vllm defaults to opencv for video IO but
gracefully falls back to torchcodec via its PlaceholderModule pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Kajal Jain <kajalj@nvidia.com>
@kajalj22
kajalj22 requested a review from a team as a code owner July 24, 2026 18:28
@copy-pr-bot

copy-pr-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@kajalj22

Copy link
Copy Markdown
Contributor Author

/ok to test a5f8335

@kajalj22 kajalj22 added CI:L1 Run doctests, unit tests, and functional tests r0.7.0 labels Jul 24, 2026
thomasdhc
thomasdhc previously approved these changes Jul 24, 2026
terrykong
terrykong previously approved these changes Jul 24, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Kajal Jain <kajalj@nvidia.com>
@kajalj22
kajalj22 dismissed stale reviews from terrykong and thomasdhc via 6c7f9d4 July 24, 2026 20:04
Comment thread tools/install_audio_deps.sh Outdated
Comment thread pyproject.toml Outdated
Comment thread tools/install_audio_deps.sh Outdated
kajalj22 and others added 2 commits July 24, 2026 15:15
- Add --no-config to all uv pip install calls in tools/install_audio_deps.sh
  so the project's sys_platform=='never' overrides don't suppress the installs
- Add cv2 import verification after opencv install
- Split opencv override-dependencies entry: never-install marker (no version)
  in override-dependencies, CVE floor (>=5.0.0) in constraint-dependencies,
  matching the pattern used for av
- Regenerate uv.lock

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Kajal Jain <kajalj@nvidia.com>
opencv-python-headless installs into the base venv but vllm runs in Ray
worker venvs without --system-site-packages, so it would never be visible
to the consumers that need it. vllm wraps all three video backends (cv2,
av, torchcodec) in a PlaceholderModule fallback — with cv2 absent it uses
torchcodec, which IS installed by this script and used by NeMo-RL's own
data loading.

Also revert the idempotency check to torchcodec-only since cv2 is no
longer managed here.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Kajal Jain <kajalj@nvidia.com>
@kajalj22

Copy link
Copy Markdown
Contributor Author

/ok to test 33aa57c

@kajalj22

Copy link
Copy Markdown
Contributor Author

/ok to test 864707d

@kajalj22
kajalj22 requested review from terrykong and thomasdhc July 24, 2026 22:18
@terrykong
terrykong enabled auto-merge (squash) July 24, 2026 22:46
@terrykong
terrykong merged commit cd1fb4f into main Jul 25, 2026
99 checks passed
@terrykong
terrykong deleted the block-opencv-headless branch July 25, 2026 02:10
kajalj22 added a commit that referenced this pull request Jul 25, 2026
Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L1 Run doctests, unit tests, and functional tests r0.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make install_audio_deps.sh robust to torch version upgrades

5 participants