Docs / Setup / Installing ComfyUI
Setup
Installing ComfyUI
The checkout, the dependency install that must not clobber torch, and keeping weights outside the repo.
Native, not containerised
Plain ComfyUI with SDXL-class models compiles nothing — it is prebuilt PyTorch wheels all the way down, so a native virtual environment is lighter and far easier to debug than a container.
Containers earn their keep when a custom node needs to build CUDA extensions against a specific
nvcc. That is a real scenario, just not this one. Keep a container runtime available as the escape
hatch and reach for it only when a node actually requires a compiler.
Checkout and dependencies
cd ~/projects
git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git comfyui
cd comfyui
uv pip install --python ~/projects/comfy-venv/bin/python -r requirements.txt
requirements.txt lists torch, torchvision, and torchaudio unpinned. Because the matched
CUDA build from the toolchain page
is already installed, those requirements are
already satisfied and are left alone. Confirm it afterwards rather than assuming:
~/projects/comfy-venv/bin/python -c "import torch; print(torch.__version__)"
# -> 2.11.0+cu130 (a bare '2.11.0' means the generic PyPI build replaced yours)
Keep the weights out of the repository
Model files are tens to hundreds of gigabytes and must survive reinstalling, upgrading, or deleting
ComfyUI. Put them in a sibling directory and point ComfyUI at it with
extra_model_paths.yaml in the ComfyUI root:
nui_models:
base_path: /home/fortega/models/
is_default: true
checkpoints: checkpoints/
diffusion_models: diffusion_models/
loras: loras/
vae: vae/
clip: clip/
clip_vision: clip_vision/
controlnet: controlnet/
upscale_models: upscale_models/
embeddings: embeddings/
configs: configs/
is_default: true makes this the tree that new downloads land in. Now rm -rf ~/projects/comfyui
costs a git clone, not a week of re-downloading.
Confirm it sees the card
Start it bound to loopback and ask it what hardware it found:
cd ~/projects/comfyui
~/projects/comfy-venv/bin/python main.py --listen 127.0.0.1 --port 8188
curl -s http://127.0.0.1:8188/system_stats | python3 -m json.tool
The devices array should name your GPU with a vram_total that matches it. On this box a clean
result looks like ComfyUI 0.31.0, pytorch_version: 2.11.0+cu130, one CUDA device of 16652042240
bytes.
Warning
Never stop ComfyUI with pkill -f main.py. Over SSH that pattern also matches the shell command
line that launched it, so it kills your own session — the symptom is a bare exit code 255 and a
process still running. Use a pidfile, or find the owner of the port:
ss -lptnH 'sport = :8188'
The comfy-down
script does exactly this.
Source: content/setup/comfyui.md · maintained in the nuilab-aigaming repository.