节点执行时报 Could not run 'torchvision::nms' / operator torchvision::nms does not exist / 全站资源搜索
搜索 更新 2026-10-02
报错 059 PyTorch、CUDA 运行库与加速库冲突 含未核实说明

节点执行时报 Could not run 'torchvision::nms' / operator torchvision::nms does not exist

报错原文(原样)
RuntimeError: Could not run 'torchvision::nms' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build).
RuntimeError: operator torchvision::nms does not exist
检索关键词 Could not run 'torchvision::nms' with arguments from the 'CUDA' backend、operator torchvision::nms does not exist、torchvision::nms、detection 节点 报错、ComfyUI-Impact-Pack nms
先看这一句 ComfyUI 能启动,但一旦进到人脸检测、分割、检测类节点(Impact Pack、ControlNet Aux 等用到 torchvision 算子的节点)就报 torchvision::nms 相关的 RuntimeError,普通出图不受影响。
适用版本 全版本通用;在 50 系显卡上更常见,因为这些用户往往手动换过 torch 而漏换 torchvision。 · 核实日期 2026-09-26 · 状态 可能已过期,正在复核
适用环境:Windows 便携版、秋叶/绘世整合包、ComfyUI Desktop、Linux + 云 GPU、全部主流环境

现象与触发场景

常见触发场景:

  • torch 和 torchvision 版本不匹配(只升了 torch,或 torchvision 被换成了 CPU 版)
  • 从 PyPI 默认索引装了 CPU 版 torchvision,而 torch 是 CUDA 版
  • 整合包里 torchvision 被某个节点依赖降级过

根因

  • torchvision::nms 是 torchvision 注册的自定义算子;当 torchvision 与 torch 版本/后端不匹配时,该算子在 CUDA 后端上没有被注册,PyTorch 的调度器就会给出 “operator does not exist” 或 “Could not run … with arguments from the 'CUDA' backend”。
  • 这类报错常出现在只替换了 torch 而没同步替换 torchvision 的场景,与上一条“CUDA 版本不一致”是同一个根因在不同环节的表现。

解决步骤

已按「最可能有效」排序。请从上往下做,每做完一步用「验证」确认,不要一次改五处。

  1. 核对 torch 与 torchvision 的版本是否成对
    打印两者的版本与 CUDA 编译版本;若 torch 是 +cu128 而 torchvision 是 +cu124/+cpu,即为版本错配。
    .\python_embeded\python.exe -c "import torch, torchvision; print('torch', torch.__version__, torch.version.cuda); print('tv', torchvision.__version__, torchvision.version.cuda)"
  2. 整组重装三件套(不要只装 torchvision 一个)
    单独 pip install torchvision 最容易让 pip 去把 torch 也一起换成 PyPI 的 CPU 版;官方推荐的修法始终是三个包一起卸载、一起从同一个 CUDA 索引安装。
    .\python_embeded\python.exe -m pip uninstall -y torch torchvision torchaudio
    .\python_embeded\python.exe -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
  3. 如果仍然报错,改用不依赖该算子的替代节点定位问题范围
    先禁用全部自定义节点启动(--disable-all-custom-nodes),确认核心工作流正常,再用二分法逐个启用,定位是哪个节点触发了 torchvision 算子;必要时把该节点换成不依赖 torchvision::nms 的实现。
    .\python_embeded\python.exe -s ComfyUI\main.py --disable-all-custom-nodes

验证是否修好

重装后再次执行原来报错的检测类节点流程,不再出现 torchvision::nms 报错;用 python -c "import torchvision; print(torchvision.ops.nms)" 能正常导入算子。

补充说明

[未核实] 部分非 NVIDIA(如 ZLUDA/ROCm)环境也会出现同名报错,其修法与 CUDA 环境不同,本条目只针对 CUDA/torch 版本错配这一主要成因。

来源

按可信度排列:官方 issue / 官方文档 > 节点仓库 issue > 社区帖 > 中文社区文章。 链接以纯文本给出(本站不做站外跳转),需要核对时请自行复制到浏览器打开。
  1. [133] (节点仓库 issue) Could not run 'torchvision::nms' with arguments from the 'CUDA' backen https://github.com/ltdrdata/ComfyUI-Impact-Pack/issues/915
  2. [144] (社区) RuntimeError: operator torchvision::nms does not exist - vision - PyTo https://discuss.pytorch.org/t/runtimeerror-operator-torchvision-nms-does-not-exist/192829
  3. [6] (官方文档) How to Troubleshoot and Solve ComfyUI Issues https://docs.comfy.org/troubleshooting/overview
本条的可靠性边界 下面这些位置带 [未核实] 标记,是采集时没找到一手来源的部分,请自行验证:
  • 补充说明

本条报错提到的节点仓库

下面这些节点仓库的名字出现在本条报错的正文里。这里只说「名字出现过」,没有断定问题就是它引起的; 点进去可以看这个包的用途、适配模型与下载量。

这条报错要用到的东西

按本条报错所属的类别(PyTorch、CUDA 运行库与加速库冲突)列出站内相关的下载包与板块入口。 它们不是「必须下载才能修好」,而是这一类问题里最常要动到的东西;具体怎么做,以上面的解决步骤为准。

环境与依赖配置包依赖版本组合清单 / 环境自检脚本说明 待挂载

同一类别的其他条目

这个解法对你有效吗 记录只存在你自己的浏览器里,不需要注册账号。

返回报错库