Linux NVIDIA ComfyUI self-start install can create a mismatched PyTorch environment
Expected Behavior
On a fresh Linux install with an NVIDIA GPU, SwarmUI should install a compatible torch / torchvision / torchaudio set for the ComfyUI self-start backend, and the backend should start successfully.
Actual Behavior
SwarmUI itself starts, but the ComfyUI self-start backend crashes immediately during startup while importing torchaudio.
This does not appear to be a generic GPU visibility problem. The logs showed the GPU was visible, for example:
Device: cuda:0 NVIDIA GeForce RTX 4090 : cudaMallocAsync
The actual failure was:
OSError: libcudart.so.12: cannot open shared object file: No such file or directory
OSError: Could not load this library: /home/user/swarmui/SwarmUI/dlbackend/ComfyUI/venv/lib/python3.12/site-packages/torchaudio/lib/_torchaudio.abi3.so
In the broken venv, the installed versions were:
torch 2.12.0torchvision 0.27.0torchaudio 2.11.0+cu129
That looks like a mixed install rather than a consistent PyTorch CUDA set.
The likely cause is the current NVIDIA install command in launchtools/comfy-install-linux.sh:
$python -s -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu129 --no-cache-dir
Using --extra-index-url appears to let pip mix PyPI wheels with PyTorch CUDA wheels, producing an incompatible package set.
Steps to Reproduce
- Fresh-install SwarmUI on Linux with NVIDIA support.
- Let SwarmUI set up the ComfyUI self-start backend.
- Start SwarmUI and let it launch the backend.
- In my case, the backend crashes on startup during
import torchaudio. - Inspecting
dlbackend/ComfyUI/venvshowed:torch 2.12.0torchvision 0.27.0torchaudio 2.11.0+cu129
I also verified the failure directly in the ComfyUI venv with:
cd /home/user/swarmui/SwarmUI/dlbackend/ComfyUI
./venv/bin/python - <<'PY'
import torch, torchaudio
print(torch.__version__)
print(torchaudio.__version__)
PY
That crashed with the same torchaudio shared-library load error.
A manual reinstall from a single PyTorch index fixed it immediately:
cd /home/user/swarmui/SwarmUI/dlbackend/ComfyUI
./venv/bin/python -s -m pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130
After that, restarting SwarmUI / restarting the backend resolved the problem.
Debug Logs
Relevant error output:
OSError: libcudart.so.12: cannot open shared object file: No such file or directory
OSError: Could not load this library: /home/user/swarmui/SwarmUI/dlbackend/ComfyUI/venv/lib/python3.12/site-packages/torchaudio/lib/_torchaudio.abi3.so
Relevant installer file and line of interest:
launchtools/comfy-install-linux.sh- current NVIDIA install command:
$python -s -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu129 --no-cache-dir
Suggested replacement:
$python -s -m pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130 --no-cache-dir
Other
- Reproduced on the latest SwarmUI version available at the time of reporting.
- The running instance reported asset version strings like
0.9.8.0.GIT-77c6ab82, matching current upstream0.9.8/ commit77c6ab82. - This appears to be a SwarmUI installer bug rather than a support issue because the problematic command is in SwarmUI itself (
launchtools/comfy-install-linux.sh), the environment it produces is internally inconsistent, and reinstalling from a single PyTorch index fixes the backend immediately. - I checked existing issues first. I did not find one matching this exact NVIDIA/Linux failure mode, but these seem related:
- Relevant paths on my machine:
/home/user/swarmui/SwarmUI/home/user/swarmui/SwarmUI/dlbackend/ComfyUI/venv
changed