This article was originally published on runaihome.com
TL;DR: This error means the PyTorch you have installed is the CPU-only build — it literally has no CUDA code compiled in, so it can't see your GPU even though the driver is fine. The fix is never to reinstall CUDA or your GPU driver; it's to uninstall the CPU torch and reinstall the matching cu12x wheel from PyTorch's own index. On an RTX 50-series card you need the cu128 build specifically.
What you'll be able to do after this guide:
- Confirm in 10 seconds whether your
torchis the CPU build or the GPU build - Reinstall the correct CUDA wheel in both ComfyUI portable and a manual venv install
- Pick the right
cu124/cu126/cu128wheel for your exact GPU (and know why RTX 50-series is different)
Honest take: 90% of the time this happens because a custom node ran
pip installsomething, pip pulledtorchas a dependency, and on Windows the default PyPItorchwheel is CPU-only. You didn't break CUDA — pip quietly swapped your good GPU build for a smaller CPU one. Reinstalling the right wheel takes about three minutes.
What the error actually means
When ComfyUI starts (or the first time it tries to move a model to the GPU) you get a traceback ending in:
File "...\torch\cuda\__init__.py", line 310, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
Read it literally: the PyTorch binary you installed was built without CUDA support. PyTorch ships in separate flavors — a CPU-only wheel and several CUDA wheels (cu124, cu126, cu128, etc.). The CPU wheel is a completely different binary with no GPU kernels in it. No driver update, no CUDA Toolkit install, and no environment variable will add CUDA to a CPU wheel. You have to replace the wheel.
This is different from a driver problem. If your NVIDIA driver were missing, nvidia-smi would fail. Run it in a terminal:
$ nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 581.xx Driver Version: 581.xx CUDA Version: 12.8 |
| 0 NVIDIA GeForce RTX 4070 ... |
+-----------------------------------------------------------------------------+
If nvidia-smi shows your card, your driver is fine and the problem is 100% on the PyTorch side. (The "CUDA Version: 12.8" line here is the maximum CUDA the driver supports, not the version PyTorch needs — a common point of confusion.)
Step 1: Confirm you actually have the CPU build
Before changing anything, prove the diagnosis. ComfyUI portable ships its own Python under python_embeded, so use that exact interpreter — not whatever python resolves to in your PATH. From the ComfyUI_windows_portable folder:
.\python_embeded\python.exe -c "import torch; print(torch.__version__); print(torch.cuda.is_available())"
A CPU build prints something like this — note the +cpu suffix and False:
2.8.0+cpu
False
A working GPU build prints a CUDA tag (+cu128) and True:
2.8.0+cu128
True
If you see +cpu or False, this guide fixes you. If you see +cu128 and True but ComfyUI still throws the error, you have two Python environments and ComfyUI is launching the wrong one — skip to the "Two-environments trap" section below.
For a manual (cloned-repo) install, run the same one-liner but activate your venv first, or call the venv's Python directly:
# Windows venv
.\venv\Scripts\python.exe -c "import torch; print(torch.__version__, torch.cuda.is_available())"
# Linux/Mac venv
./venv/bin/python -c "import torch; print(torch.__version__, torch.cuda.is_available())"
Step 2: Pick the right CUDA wheel for your GPU
This is the part people get wrong. The wheel tag (cu124, cu126, cu128) is the CUDA runtime bundled inside the PyTorch wheel. It does not need to match a CUDA Toolkit on your machine — the wheel is self-contained. What it does need to match is your GPU architecture.
| Your GPU | Architecture | Wheel to install | Minimum PyTorch |
|---|---|---|---|
| RTX 50-series (5060 Ti / 5070 / 5080 / 5090) | Blackwell, sm_120
|
cu128 |
2.7.0 |
| RTX 40-series (4060 Ti / 4070 / 4080 / 4090) | Ada, sm_89
|
cu124, cu126, or cu128
|
any current |
| RTX 30-series (3060 / 3080 / 3090) | Ampere, sm_86
|
cu124, cu126, or cu128
|
any current |
The RTX 50-series is the trap. Blackwell's sm_120 compute capability was only added to stable PyTorch in 2.7.0, which shipped the first pre-built CUDA 12.8 wheels with native Blackwell support. If you install an older cu124 wheel on an RTX 5090, you'll get past this error only to hit CUDA error: no kernel image is available for execution on the device — the sibling problem of running a too-old wheel on a too-new GPU. On a 50-series card, use cu128 and PyTorch 2.7.0 or newer, full stop.
For RTX 30/40-series, any of cu124/cu126/cu128 works; cu128 is the safe current default since it's what ComfyUI's own portable builds ship now.
Step 3: Reinstall — ComfyUI portable (Windows)
From inside the ComfyUI_windows_portable directory, uninstall the bad trio first so pip doesn't try to "keep" the CPU build:
.\python_embeded\python.exe -m pip uninstall -y torch torchvision torchaudio
Then install the CUDA wheel from PyTorch's index. For an RTX 50-series card:
.\python_embeded\python.exe -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
Note --index-url, not --extra-index-url. Using --index-url forces pip to pull only from the PyTorch index, which guarantees you get the GPU wheel instead of pip silently falling back to the CPU-only one on PyPI. That fallback is the exact mechanism that broke you in the first place.
Re-run the check from Step 1. You want +cu128 and True. Then launch ComfyUI and the error is gone.
If the download is slow or stalls — the CUDA wheels are large, often 2.5 GB-plus because they bundle the CUDA runtime, cuDNN, and NCCL — let it finish; that size is normal and is the whole reason PyPI defaults to the small CPU wheel on Windows in the first place.
Step 4: Reinstall — manual / venv install (Windows, Linux)
If you cloned the repo and run inside a venv, activate it, then do the same uninstall/reinstall:
# activate first
source venv/bin/activate # Linux/Mac
.\venv\Scripts\activate # Windows
pip uninstall -y torch torchvision torchaudio
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
ComfyUI also publishes a maintained requirements path; if you'd rather follow the project's pinned versions, the official install docs list the current recommended cu128 command for your platform. Either way the principle is identical: uninstall CPU torch, install the cu128 wheel from the PyTorch index.
Why this keeps happening (and how to stop it)
On Windows and macOS, the torch package on the default Python Package Index (PyPI) is the CPU-only wheel. PyPI serves the lightweight CPU binary by default to those platforms; the CUDA-enabled wheels live only on PyTorch's own download index. So the moment anything runs a plain pip install torch — or installs a package that lists torch as a dependency without pinning the CUDA build — pip happily grabs the CPU wheel from PyPI and overwrites your working GPU install.
The usual culprit is a custom node. You install some shiny new node, its requirements.txt says torch>=2.x, ComfyUI's "install dependencies" step runs, pip decides your current torch doesn't satisfy something, and it reinstalls from PyPI — CPU build. ComfyUI was fine yesterday and broken today, and you "didn't change anything." You did: a node did.
Two habits prevent the relapse:
- When installing custom-node requirements, never let pip touch torch. If a node's requirements pull torch, install the node

