ComfyUI Desktop 0.7.2解决方法

为了躲避论坛要求不能超过2个链接,所下面https:// 加了空格 而且格式比较乱,需要你让ai读出并编排任务

ComfyUI Desktop 0.7.2 安装失败:Torch not compiled with CUDA enabled

问题描述

Windows 系统安装 ComfyUI Desktop 0.7.2 时,启动报错:
AssertionError: Torch not compiled with CUDA enabled

环境信息

  • 系统: Windows
  • GPU: NVIDIA GPU(双显卡)
  • CUDA: 13.0
  • ComfyUI Desktop 版本: 0.7.2

根本原因

ComfyUI Desktop 0.7.2 使用 UV 包管理器安装 PyTorch 时,要求安装 torch==2.9.1+cu130,但 UV 的依赖解析逻辑存在 bug:

[info] Running uv command: uv pip install “torch==2.9.1+cu130” … --index-url 索引URL
[error] No solution found when resolving dependencies:
`-> Because there is no version of torch==2.9.1+cu130 and you require torch==2.9.1+cu130
[warn] Failed to install recommended NVIDIA PyTorch packages. Falling back to unpinned install.

虽然 PyTorch 官方 cu130 源中确实存在 torch-2.9.1+cu130-cp312-cp312-win_amd64.whl,但 UV 会错误地回退安装 CPU 版本 torch==2.9.1+cpu。

解决方案

手动从 PyTorch 官方源 URL 安装 CUDA 版本:

进入 ComfyUI 虚拟环境目录

cd %USERPROFILE%\Documents\ComfyUI

卸载 CPU 版本

.venv\Scripts\python.exe -m pip uninstall torch torchvision torchaudio -y

直接从 URL 安装 cu130 版本

PyTorch官方下载地址:download dot pytorch dot org slash whl slash cu130 slash

.venv\Scripts\python.exe -m pip install ^
https:// download dot pytorch dot org/whl/cu130/torch-2.9.1+cu130-cp312-cp312-win_amd64.whl" ^
https:// download dot pytorch dot org/whl/cu130/torchvision-0.24.1+cu130-cp312-cp312-win_amd64.whl" ^
https:// download dot pytorch dot org/whl/cu130/torchaudio-2.9.1+cu130-cp312-cp312-win_amd64.whl"

注意: 如果使用 PowerShell,+ 需要转义为 %2B;如果使用 CMD,直接使用 +。安装时请把 dot 改回 .,slash 改回 /。

验证安装

import torch
print(f"Torch: {torch.version}“)
print(f"CUDA available: {torch.cuda.is_available()}”)
print(f"CUDA version: {torch.version.cuda}")

正确输出:
Torch: 2.9.1+cu130
CUDA available: True
CUDA version: 13.0