fix(comfyui): pin managed torch stack during install (EAI-8051) - #298
Open
fredespi wants to merge 1 commit into
Open
fix(comfyui): pin managed torch stack during install (EAI-8051)#298fredespi wants to merge 1 commit into
fredespi wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rocm comfyui installinstalls ComfyUI's dependencies into the machine's managed ROCm runtime. It already filterstorch/torchvision/torchaudioout of ComfyUI's direct requirement specs, but nothing scopes package resolution — so a transitive ComfyUI dependency can still resolvetorchfrom PyPI, pull a CUDA build plusnvidia-*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
uv pip installfor ComfyUI's deps, probe the managed runtime's currently-installedtorch/torchvision/torchaudioversions viaimportlib.metadata(no native import needed).--constraintfile and pass it to the install. The resolver treats the stack as already satisfied and never replaces it; because ROCm torch has nonvidia-*dependencies, none are pulled in.--constraintargument wiring.Test plan
cargo test -p rocm(Linux) — 477 tests pass, including 3 new ComfyUI tests.cargo clippy/cargo fmt --checkclean.@requires-gpu @nightlyscenariocomfyui-install-preserves-the-rocm-runtimefrom test(e2e): pin the driver-as-root and comfyui-runtime contracts (EAI-8071) #291 (EAI-8071), which runs on a GPU host after that contract lands.