SwarmUI icon indicating copy to clipboard operation
SwarmUI copied to clipboard

Linux NVIDIA ComfyUI self-start install can create a mismatched PyTorch environment

Open vforge opened this issue 6 months ago • 1 comments

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.0
  • torchvision 0.27.0
  • torchaudio 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

  1. Fresh-install SwarmUI on Linux with NVIDIA support.
  2. Let SwarmUI set up the ComfyUI self-start backend.
  3. Start SwarmUI and let it launch the backend.
  4. In my case, the backend crashes on startup during import torchaudio.
  5. Inspecting dlbackend/ComfyUI/venv showed:
    • torch 2.12.0
    • torchvision 0.27.0
    • torchaudio 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 upstream 0.9.8 / commit 77c6ab82.
  • 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:
    • #1178 - Linux installer / torch-family mismatch on AMD path
    • #141 - Linux installer index issue
    • #1128 - recovery by reinstalling torch packages from a specific PyTorch index
  • Relevant paths on my machine:
    • /home/user/swarmui/SwarmUI
    • /home/user/swarmui/SwarmUI/dlbackend/ComfyUI/venv

vforge avatar May 31 '26 04:05 vforge

changed

mcmonkey4eva avatar Jun 05 '26 00:06 mcmonkey4eva