Skip to content

fix(docker): shadow distro-owned PyYAML on TRT-LLM bases before smg install - #1666

Merged
slin1237 merged 1 commit into
mainfrom
fix/engine-image-pyyaml-install
Jun 11, 2026
Merged

slin1237 merged 1 commit into
mainfrom
fix/engine-image-pyyaml-install

Conversation

@slin1237

@slin1237 slin1237 commented Jun 11, 2026 •

Copy link
Copy Markdown
Member

Description

The build (nvcr.io/nvidia/tensorrt-llm/release:1.3.0rc18) dry-run on #1665 fails in install-smg.sh:

Attempting uninstall: pyyaml
  Found existing installation: PyYAML 6.0.1
error: uninstall-no-record-file
× Cannot uninstall PyYAML 6.0.1
╰─> The package's contents are unknown: no RECORD file was found for PyYAML.
hint: The package was installed by debian.

The rc18 NGC base ships a debian-owned PyYAML (rc10 did not). The smg wheel install uses --force-reinstall, which reinstalls the dependency set including pyyaml, and pip cannot uninstall a RECORD-less distro package.

Changes

One conditional step in docker/engine.Dockerfile, scoped to ENGINE=trtllm, before install-smg.sh: pip install --ignore-installed pyyaml installs a pip-managed copy that shadows the distro one on sys.path and in pip's metadata view, so the smg install can then upgrade pyyaml through its normal uninstall/reinstall path.

Deliberately NOT a blanket --ignore-installed in the shared install-smg.sh: that would make pip blind to every installed distribution on all engine bases and risks hybrid installs / stomping engine-pinned deps on the sglang/vllm images that build fine today.

Test Plan

  • This PR's own trtllm dry-run still builds on the rc10 base (main's pin), so it proves no regression but not the fix itself.
  • The fix is proven by rebasing chore: bump versions for v1.5.0 release #1665 (which moves the base to rc18) on top of this once merged — its build (…rc18) dry-run should go green.
  • sglang/vllm/tgl build paths are untouched (conditional is trtllm-only).

Summary by CodeRabbit

  • Bug Fixes
    • Resolved Docker build failures for specific engine configurations by improving package dependency handling during container initialization.

…nstall

The SMG+TRTLLM image build fails on the NGC 1.3.0rc18 base: it ships a
debian-installed PyYAML 6.0.1 without a pip RECORD file, and the smg
wheel install (--force-reinstall, dependency set includes pyyaml) dies
with "uninstall-no-record-file" when pip tries to remove it.

Pre-install a pip-managed PyYAML with --ignore-installed, scoped to
ENGINE=trtllm: the fresh copy shadows the distro one on sys.path and in
pip's metadata view, so install-smg.sh can upgrade pyyaml through its
normal uninstall/reinstall path. The sglang/vllm/tgl builds keep their
exact pip behavior.

Signed-off-by: Simo Lin <25425177+slin1237@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The Dockerfile now conditionally installs a pip-managed pyyaml package when the TensorRT-LLM engine is selected, running before the install-smg.sh script. This works around distro-provided PyYAML lacking an uninstall RECORD file that causes pip failures.

Changes

TensorRT-LLM PyYAML Installation

Layer / File(s) Summary
Conditional pyyaml installation for trtllm engine
docker/engine.Dockerfile
Adds a conditional RUN step that installs pip-managed PyYAML only when ENGINE=trtllm, using --no-cache-dir --ignore-installed to shadow the distro-provided package and avoid pip uninstall conflicts before install-smg.sh executes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • lightseekorg/smg#843: Both PRs modify engine-specific conditional installation logic in docker/engine.Dockerfile to pull different dependencies for different engines.
  • lightseekorg/smg#675: Both PRs address pip installation behavior during engine image builds to resolve distro PyYAML uninstall issues through different approaches (conditional install vs. --no-deps flag).

Suggested labels

docker

Suggested reviewers

  • CatherineSue
  • gongwei-130

Poem

🐰 Whiskers twitching with delight,
One small change, perfectly right!
PyYAML shadows in trtllm's way,
No more distro package dismay!
A docker tweak, clean and bright. 🎩✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: conditionally installing pip-managed PyYAML to shadow the distro-provided version on TRT-LLM bases before the smg installation, which directly addresses the core issue in this changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/engine-image-pyyaml-install

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the docker Docker configuration changes label Jun 11, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Dockerfile to conditionally install pyyaml with pip when the ENGINE is set to trtllm to bypass a dependency uninstallation issue. The reviewer suggests using python3 -m pip instead of calling pip directly to ensure robustness and use of the correct Python interpreter.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread docker/engine.Dockerfile
# then upgrade pyyaml normally. Scoped to trtllm so the other engine bases
# keep their exact pip behavior.
RUN if [ "${ENGINE}" = "trtllm" ]; then \
pip install --no-cache-dir --ignore-installed pyyaml; \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using python3 -m pip is more robust than calling pip directly. It ensures that the package is installed using the correct Python 3 interpreter and avoids potential issues where the pip executable is not in the PATH or points to a different Python installation.

      python3 -m pip install --no-cache-dir --ignore-installed pyyaml; \

@claude

claude Bot commented Jun 11, 2026

Copy link
Copy Markdown

👋 The PR description doesn't fully follow
PULL_REQUEST_TEMPLATE.md:

  • Missing header: ### Problem
  • Missing header: ### Solution

Please update the PR description so reviewers have the context they need.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, well-scoped fix. The conditional pip install --ignore-installed pyyaml correctly shadows the distro-owned package so install-smg.sh's --force-reinstall can proceed. No issues found.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docker/engine.Dockerfile`:
- Around line 65-67: The Dockerfile RUN that executes pip install
--ignore-installed pyyaml when ENGINE=trtllm leaves PyYAML unpinned and
build-time dependent; update the build to pin a specific PyYAML version (or use
a pip constraints file) so the resolved version is reproducible: either add a
pinned spec (e.g., pyyaml==X.Y.Z) in the RUN that installs it, add the same
fixed version into bindings/python/pyproject.toml dependencies, or supply a
constraints file referenced by pip; alternatively, add a clear comment in the
RUN and documentation explaining that drifting versions are intentional and
acceptable—reference the RUN block in docker/engine.Dockerfile,
scripts/installation/install-smg.sh (which currently doesn’t touch PyYAML), and
bindings/python/pyproject.toml when making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b02c16a0-ffe6-4a71-bcfd-4534f2de44fd

📥 Commits

Reviewing files that changed from the base of the PR and between 0ec9d91 and 215cbdf.

📒 Files selected for processing (1)
  • docker/engine.Dockerfile

Comment thread docker/engine.Dockerfile
@slin1237
slin1237 merged commit b295a79 into main Jun 11, 2026
37 of 39 checks passed
@slin1237
slin1237 deleted the fix/engine-image-pyyaml-install branch June 11, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker configuration changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant