Skip to content

fix(comfyui): pin managed torch stack during install (EAI-8051) - #298

Open
fredespi wants to merge 1 commit into
mainfrom
rocm-comfyui-install-replaces-managed-rocm
Open

fix(comfyui): pin managed torch stack during install (EAI-8051)#298
fredespi wants to merge 1 commit into
mainfrom
rocm-comfyui-install-replaces-managed-rocm

Conversation

@fredespi

Copy link
Copy Markdown
Collaborator

Summary

rocm comfyui install installs ComfyUI's dependencies into the machine's managed ROCm runtime. It already filters torch/torchvision/torchaudio out of ComfyUI's direct requirement specs, but nothing scopes package resolution — so a transitive ComfyUI dependency can still resolve torch from PyPI, pull a CUDA build plus nvidia-* wheels, and displace the runtime's ROCm torch. The runtime the whole machine serves models with then becomes a CUDA build with no AMD GPU support: installing an optional app breaks the base runtime (and vLLM serving with it).

This pins the managed runtime's existing torch stack to its exact installed versions so the resolver can never swap in a CUDA build.

Changes

  • Before running uv pip install for ComfyUI's deps, probe the managed runtime's currently-installed torch/torchvision/torchaudio versions via importlib.metadata (no native import needed).
  • Write those as a uv --constraint file and pass it to the install. The resolver treats the stack as already satisfied and never replaces it; because ROCm torch has no nvidia-* dependencies, none are pulled in.
  • A genuine version conflict (a dep needing an incompatible torch) now fails the install loudly instead of silently corrupting the runtime.
  • Added unit tests for the constraint-line generation and the --constraint argument wiring.

Test plan

ComfyUI dependency install runs `uv pip install` into the machine's
managed ROCm runtime. Direct torch/torchvision/torchaudio specs are
filtered out, but nothing scopes resolution, so a transitive dependency
still resolves torch from PyPI and drags in a CUDA build plus nvidia-*
wheels, displacing the runtime's ROCm torch and leaving a runtime with
no AMD GPU support.

Probe the runtime's installed torch-stack versions via importlib
metadata (no native import) and pass a uv --constraint file pinning them
to those exact versions. The resolver treats them as satisfied and never
swaps in a CUDA build; ROCm torch has no nvidia-* deps, so none appear.
A genuine version conflict now fails the install loudly instead of
silently corrupting the runtime.

Signed-off-by: fredespi <fredrik.espinoza@gmail.com>
@fredespi
fredespi requested a review from a team as a code owner August 22, 2026 12:09
@fredespi
fredespi requested a review from juhovainio August 22, 2026 12:09
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