Docs / Setup / Toolchain: Python and PyTorch
Setup
Toolchain: Python and PyTorch
Why Python 3.12 and torch 2.11.0+cu130, and how both version choices fail silently if you get them wrong.
Two version decisions here are load-bearing. Both have failure modes that look like something else, which is why they get their own page.
Do not use the system Python
The host ships Python 3.14, which is ahead of what PyTorch publishes wheels for. Installing into
it fails at best and builds something unsupported at worst. We install uv (opens in new tab)
into the user’s own ~/.local/bin and pin a 3.12 virtual environment, leaving the system
interpreter untouched:
curl -LsSf https://astral.sh/uv/install.sh -o /tmp/uv-install.sh && sh /tmp/uv-install.sh
uv venv ~/projects/comfy-venv --python 3.12
3.12 rather than 3.13 is deliberate: custom ComfyUI nodes are the least-maintained part of this ecosystem, and they lag the newest interpreter by a wide margin.
Warning
uv from the distribution package manager here. On this box that path tried to
import a third-party GPG key as a side effect of resolving the package. The official installer
script is self-contained and stays inside the user’s home directory.Match the CUDA build to the driver — not to habit
The card is Blackwell, compute capability sm_120. A PyTorch build without sm_120 kernels
does not necessarily error; it can fall back or fail deep inside a generation with a confusing
message. Verify the architecture is actually compiled in, rather than trusting that CUDA “works”.
The driver on this box exposes CUDA 13.3, so we take the cu130 wheels:
uv pip install --python ~/projects/comfy-venv/bin/python \
--index-url https://download.pytorch.org/whl/cu130 \
torch==2.11.0 torchvision==0.26.0 torchaudio==2.11.0
Why 2.11.0 and not the newest torch
At the time of writing the index carried torch up to 2.13.0, and taking the newest is the obvious move. It is the wrong one here:
torchaudiostops at 2.11.0 on every CUDA index. ComfyUI’srequirements.txtliststorchaudioas a dependency. Installing torch 2.13 leaves that requirement unsatisfiable without a version fight, and resolving it drags torch back down anyway.
2.11.0 is the newest fully-matched trio — torch 2.11.0, torchvision 0.26.0, torchaudio 2.11.0.
Take the matched set. The pairing is lockstep: torch 2.x goes with torchvision 0.(x+15) and
torchaudio 2.x.
Verify before going further
Detection is not the same as having kernels. Check the architecture list and run a real computation:
import torch
print(torch.__version__, torch.version.cuda, torch.cuda.is_available())
print(torch.cuda.get_arch_list()) # must contain 'sm_120'
a = torch.randn(4096, 4096, device="cuda", dtype=torch.float16)
print(float((a @ a)[0, 0])) # a real kernel launch
On this machine that prints 2.11.0+cu130 13.0 True, an arch list ending in sm_120, and a finite
number. If the arch list lacks your card’s capability, stop and fix it now — everything downstream
will be mystifying otherwise.
Tip
Source: content/setup/toolchain.md · maintained in the nuilab-aigaming repository.