ComfyUI Torch Not Compiled With CUDA Enabled Fix on Windows
Fix ComfyUI Torch not compiled with CUDA enabled by checking active Python, CPU-only PyTorch, NVIDIA driver, and Windows launch path.
If you searched for ComfyUI torch not compiled with CUDA enabled fix, ComfyUI torch not compiled with CUDA enabled fix Windows, or ComfyUI shows AssertionError: Torch not compiled with CUDA enabled, the Python environment that launched ComfyUI cannot use CUDA through PyTorch.
That usually means one of four things:
- ComfyUI is running with CPU-only Torch.
- You launched the wrong portable batch file, ComfyUI Desktop runtime, or virtual environment.
- A custom node install replaced the working GPU build of
torch. - Your NVIDIA driver is too old for the CUDA build you installed.
Do the checks below in order. Do not keep installing random plugin requirements until the exact Python that starts ComfyUI reports torch.cuda.is_available() == True.
Fast rule
nvidia-smi proves Windows can see the GPU. It does not prove ComfyUI's Python can use CUDA. Always test Torch inside the same portable python_embeded, Desktop-managed environment, or venv that starts ComfyUI.
Quick diagnosis
| Check | Command | What good looks like |
|---|---|---|
| GPU visible to Windows | nvidia-smi | Shows your NVIDIA GPU and driver version |
| Active Python | python -c "import sys; print(sys.executable)" | Matches the ComfyUI launch environment, not a random global Python |
| Torch build | python -c "import torch; print(torch.__version__); print(torch.version.cuda)" | Version does not end in +cpu; CUDA is not None |
| CUDA available | python -c "import torch; print(torch.cuda.is_available())" | Prints True |
| Correct launch path | Portable users run run_nvidia_gpu.bat | You are not launching the CPU batch or a different Python |
If nvidia-smi works but torch.cuda.is_available() is False, your driver can see the GPU, but the Python environment cannot use it through PyTorch.
Windows Fix: Pick the Right Runtime First
Before reinstalling PyTorch, identify which ComfyUI runtime you are actually repairing:
| Install type | First thing to verify | Why it matters |
|---|---|---|
| Windows portable | You launched run_nvidia_gpu.bat and tested .\python_embeded\python.exe | Portable ComfyUI does not use your global Python |
| ComfyUI Desktop | You are using Desktop's managed runtime or repair path | Global pip install torch will not fix Desktop's private environment |
| Manual venv | The venv is activated before testing or installing | Otherwise the repair can land in system Python |
If you cannot identify the active Python, stop here and use ComfyUI Python Embedded Explained before changing packages.
CUDA still blocked after checking the runtime?
If this error is blocking real work, preserve the task logs and use the launcher-native diagnostics path before trying more blind package installs.
Open diagnostics pathExact error logs
This guide applies when your terminal, browser console, or ComfyUI log contains one of these lines:
AssertionError: Torch not compiled with CUDA enabled
Torch not compiled with CUDA enabled
torch.cuda.is_available() is False
CUDA is not availableIf the error appears while loading a workflow, treat it as a runtime problem first. If it appeared immediately after installing a custom node, treat it as dependency drift: the node installer may have replaced CUDA-enabled Torch with a CPU wheel or an incompatible build.
Case-review checks before reinstalling Torch
Recent Agent-case reviews showed that this error is easy to misclassify. The
most common false path is: nvidia-smi works, so the repair assumes CUDA is
healthy, even though ComfyUI is running a different Python or a CPU-only PyTorch
wheel.
Use this sequence before changing packages:
| Evidence | What it proves | What to check next |
|---|---|---|
nvidia-smi shows the GPU | Windows and the NVIDIA driver can see the card | Test PyTorch in the same Python that starts ComfyUI |
torch.version.cuda is None or version ends in +cpu | Active PyTorch is CPU-only | Reinstall PyTorch from the correct CUDA wheel index |
torch.cuda.is_available() is False in one terminal | That terminal's Python cannot use CUDA | Compare sys.executable with the ComfyUI launch path |
| CUDA works in system Python but not portable Python | Wrong environment was tested | Repair python_embeded or the launch venv, not the global Python |
| Error appeared after a custom-node install | A dependency install may have replaced Torch | Repair the core Torch stack before installing more plugin requirements |
Do not mark the repair complete until the ComfyUI launch environment prints a CUDA-enabled Torch build and ComfyUI starts from the expected folder.
Step 1: Test the same Python that launches ComfyUI
The most common mistake is testing one Python and launching ComfyUI with another.
Windows portable
Open Command Prompt inside the portable folder and run:
.\python_embeded\python.exe -s -c "import sys, torch; print('python', sys.executable); print('torch', torch.__version__); print('cuda build', torch.version.cuda); print('cuda available', torch.cuda.is_available()); print('device', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'none')"Then make sure you start ComfyUI with:
run_nvidia_gpu.batIf you use run_cpu.bat, CUDA will not be used even when the GPU driver is healthy.
If the portable folder has both CPU and NVIDIA batch files, do not repair packages until you confirm the NVIDIA batch is the one being used.
ComfyUI Desktop
ComfyUI Desktop manages its own runtime. Do not run pip install torch in a random global terminal and expect Desktop to change.
Use the app's own environment, terminal, repair option, or reinstall/update flow. The diagnosis is the same, but the target is different: the Python inside the Desktop runtime must report a CUDA-enabled PyTorch build.
Manual install or venv
Activate the environment you use for ComfyUI, then run:
python -c "import sys, torch; print('python', sys.executable); print('torch', torch.__version__); print('cuda build', torch.version.cuda); print('cuda available', torch.cuda.is_available()); print('device', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'none')"
python -m pip show torch torchvision torchaudio
python -m pip checkIf torch.version.cuda is None, or the version shows +cpu, you are on a CPU-only PyTorch build.
Step 2: Check the NVIDIA driver before reinstalling Torch
Run:
nvidia-smiIf the command is missing or cannot see your GPU, fix the driver first. Updating PyTorch will not help if the operating system cannot expose the GPU.
If nvidia-smi works, compare your setup with the current ComfyUI package or install guide before reinstalling packages. Portable releases can change their bundled Python, PyTorch, and CUDA combination over time, so the repair command must match the environment you actually installed. As of this verification pass, the official ComfyUI system requirements page says the current Windows portable build uses Python 3.13 with PyTorch CUDA 13.0, while older portable downloads and compatibility packages may still use older Python or CUDA builds.
- New NVIDIA GPUs usually need a recent CUDA-enabled PyTorch build.
- Older custom nodes may lag behind the newest Python or PyTorch stack.
- Newer ComfyUI features can need newer PyTorch builds than an old portable folder has installed.
For a clean repair, first decide whether you are fixing the existing environment or moving to a fresh ComfyUI package whose Python, CUDA, and PyTorch versions already match your GPU. For many portable users, downloading the correct NVIDIA portable package is lower risk than trying to mutate an old broken folder.
Step 3: Repair PyTorch in the correct environment
Use the PyTorch selector for the latest command that matches your OS, package manager, Python version, and GPU. The examples below show common NVIDIA paths that were checked on 2026-06-22, but the selector should be your source of truth when versions change.
Example NVIDIA path: CUDA 13.0
Use this only when the PyTorch selector says it matches your Python version, platform, and driver/GPU target.
python -m pip uninstall -y torch torchvision torchaudio xformers
python -m pip install --upgrade pip
python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130
python -m pip install -r requirements.txtCompatibility fallback: CUDA 12.8
python -m pip uninstall -y torch torchvision torchaudio xformers
python -m pip install --upgrade pip
python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
python -m pip install -r requirements.txtOlder GPU fallback: CUDA 12.6
python -m pip uninstall -y torch torchvision torchaudio xformers
python -m pip install --upgrade pip
python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
python -m pip install -r requirements.txtAfter reinstalling, verify again:
python -c "import torch; print(torch.__version__); print(torch.version.cuda); print(torch.cuda.is_available())"Do not reinstall xformers until ComfyUI starts successfully. If there is no verified xformers wheel for your Python, Torch, and CUDA combination, launch ComfyUI with --use-pytorch-cross-attention instead.
Choose repair or fresh install
| Situation | Better path |
|---|---|
| You downloaded a CPU portable package by mistake | Download the NVIDIA portable package instead of patching packages by hand |
You launched run_cpu.bat | Start with run_nvidia_gpu.bat before reinstalling Torch |
| A custom node broke an environment that used to work | Repair Torch in the same Python, then reinstall the node carefully |
| ComfyUI Desktop runtime is broken | Use Desktop's runtime repair/update path, not global pip |
Multiple core packages conflict in pip check | Fresh portable install is usually faster |
Step 4: If a custom node caused it
If the error appeared right after installing a custom node, treat it as dependency drift:
- Save the error log before changing more packages.
- Check what changed:
python -m pip checkandpython -m pip show torch. - Repair
torch,torchvision, andtorchaudiofirst. - Reinstall the custom node only after confirming CUDA works.
- Use
--no-depsfor packages that try to pull their own Torch build, then install only the missing package versions you actually need.
See ComfyUI Dependency Conflicts and Installed Custom Nodes and Broke ComfyUI? before continuing with plugin repairs.
What not to do
- Do not install the CUDA Toolkit first unless a package specifically needs compilation. PyTorch wheels bundle the CUDA runtime they need for normal use.
- Do not trust
nvidia-smialone. It proves the driver sees the GPU, not that PyTorch can use CUDA. - Do not run
pip install -r requirements.txtfrom random custom nodes until the core runtime is fixed. - Do not mix the portable embedded Python with a global Python install.
- Do not keep submitting the same broken command if the error says "No matching distribution"; your Python version or wheel index may not support that combo.
When reinstalling is faster
Repair is worth trying when the environment only has a bad Torch build. A clean portable package is faster when:
- multiple core packages were downgraded
pip checkshows many hard conflicts- you do not know which Python launches ComfyUI
- you need a stable baseline for RTX 50-series or older GTX hardware
Use ComfyUI Portable for a clean Windows baseline, or Manual Install when you need full control over Python and GPU packages.
Related guides
- ComfyUI GPU Compatibility
- ComfyUI Dependency Conflicts
- ComfyUI Startup Failed? How to Diagnose and Recover Faster
- Installed Custom Nodes and Broke ComfyUI? Recover Without Reinstalling
- ComfyUI Common Issues and Fast Fixes
Best next step
If CUDA worked before and broke after plugin or environment changes, start by repairing the active Python environment. If this keeps happening, Wonderful Launcher is the safer path for preserving existing workflows, models, task logs, and recovery notes. If the machine is still blocked, contact support instead of continuing random package repairs.
Source References
Start free with Wonderful Launcher if this affects your real ComfyUI environment. It keeps launcher-native repair, task logs, and runtime checks in one place; credits are only for image generation and metered tools.
Download Wonderful LauncherSee credit packagesDid this fix your issue?
Your answer helps prioritize verified ComfyUI repairs.