LogoWonderful Launcher
  • 首页
  • 定价
  • 文档
  • 下载
修复 ComfyUI 中的 No module named 错误ComfyUI 依赖冲突:无需重装即可修复ComfyUI ModuleNotFoundError: No module named 'torch' 修复ComfyUI 提示 No module named 'transformers':怎么修ModuleNotFoundError: No module named 'onnx' 或 'onnxruntime'(ComfyUI)ModuleNotFoundError: No module named 'triton'(ComfyUI)ComfyUI ModuleNotFoundError: No module named 'sageattention' 修复ComfyUI ModuleNotFoundError: No module named 'insightface' 修复ModuleNotFoundError: No module named 'nunchaku'(ComfyUI 中缺少 nunchaku 模块)ModuleNotFoundError: No module named 'cv2' in ComfyUIModuleNotFoundError:ComfyUI 中找不到模块 'groundingdino' 或 'segment_anything'
缺包错误

ModuleNotFoundError: No module named 'triton'(ComfyUI)

Partially verifiedMedium riskTested on Windows 10, Windows 11 | portable | Python 3.11+ | CUDA 12.x | Torch 2.x | ComfyUI portable embedded Python, triton-windows, and SageAttention-linked repairsLast verified 2026-07-08Estimated time 10-30 分钟

修复 ComfyUI 中的 ModuleNotFoundError: No module named 'triton'——区分无害的 comfy_kitchen 日志与阻塞性的 SageAttention、WanVideoWrapper 或加速栈故障。

如果你搜索的是 ModuleNotFoundError: No module named 'triton'、comfyui no module named triton,或者完整的 Found comfy_kitchen backend triton: {'available': False, ...} 日志,请先判断这究竟只是一条可选后端报告,还是会阻塞工作流的导入错误。

如果 ComfyUI 仍能正常打开且普通工作流可以运行,不必理会 Triton。如果 Easy-SAM3、Trellis、WanVideoWrapper、SageAttention 或其他节点因为导入 Triton 而失败,请在启动 ComfyUI 所用的同一 Python 环境中修复 Triton。在 Windows 上,请使用 triton-windows,而不是盲目执行 pip install triton。

如果你的阻塞错误只是 No module named 'sageattention' 且未提及 Triton,请先参阅 SageAttention 缺失。

triton 既可能是可忽略的可选加速警告,也可能是真正阻断工作流的缺失依赖。本页的重点是先把“可以忽略的警告”和“需要修复的导入错误”分开。

30 秒决策

如果唯一的消息是 comfy_kitchen backend triton 且 ComfyUI 能正常打开,就不必处理。如果 Easy-SAM3、Trellis、WanVideoWrapper、SageAttention 或其他工作流出现 ModuleNotFoundError: No module named 'triton' 失败,请在启动 ComfyUI 所用的同一 Python 环境中修复 Triton。在 Windows 上,从 triton-windows 入手,而不是盲目执行 pip install triton。

快速参考

你看到的内容含义推荐操作
Found comfy_kitchen backend triton: {'available': False, ...} 且 ComfyUI 能正常打开可选后端不可用通常可忽略
工作流导入或队列执行时出现 ModuleNotFoundError: No module named 'triton'某个自定义节点实际尝试导入 Triton在同一 Python 环境中修复 Triton
SageAttention 节点出现 No module named 'triton'SageAttention 或自定义节点需要 Triton在同一 Python 环境中修复 Triton
SageAttention 或 Triton 安装附近出现 No module named 'flash_attn'相邻的注意力加速包缺失在创建单独修复路径之前,将其视为同一加速栈的一部分
Windows 上 pip install triton 失败普通 triton 包路径不适用于 Windows改用 triton-windows
安装了 Triton 但 ComfyUI 仍无法导入安装到了错误的 Python 环境使用实际启动 ComfyUI 的 Python 环境
安装后出现 tcc.exe、triton_key 或编译器错误版本或运行时不匹配检查 PyTorch/Triton 映射关系,必要时回滚

问题分类

日志里常见两种不同的 Triton 模式:

模式公开症状处理方式
可选能力警告Found comfy_kitchen backend triton: {'available': False, ...} 但 ComfyUI 仍能打开不要仅为消除这一行而更换包
致命导入错误加载或排队工作流时出现 ModuleNotFoundError: No module named 'triton'在启动 ComfyUI 的 Python 环境中修复 Triton
加速栈故障启用 SageAttention 或视频加速后出现 No module named 'triton'、triton_key、tcc.exe 或编译器/DLL 错误先修复 Triton,再验证 SageAttention 或视频节点
相邻注意力包故障No module named 'flash_attn'、flash_attn.bert_padding 或 flash_attn.flash_attn_interface检查工作流是否真正需要 FlashAttention;不要把它和 Triton/SageAttention 混成同一个包来修

如果同一启动警告反复出现但工作流仍能运行,那只是噪音。如果某个特定自定义节点因导入 triton 而停止运行,则需要采取行动。

如果日志中提到 comfy_kitchen backend triton

这条精确的日志通常是能力报告,并不总是崩溃:

Found comfy_kitchen backend triton: {'available': False, 'disabled': True, 'unavailable_reason': "ImportError: No module named 'triton'", 'capabilities': []}

如果 ComfyUI 能正常打开且工作流可以运行,不必为了消除这一行而修复 Triton。如果来自 Easy-SAM3、Trellis、WanVideoWrapper、SageAttention 或其他加速密集型节点的工作流在此消息后立即失败,则应将 Triton 视为阻塞依赖链的一部分。

判断逻辑很简单:可选启动报告意味着观察即可;工作流导入或队列执行时失败意味着需要在同一 Python 环境中修复。

日志的样式

你可能会在启动时看到这样一行:

Found comfy_kitchen backend triton: {'available': False, 'disabled': True, 'unavailable_reason': "ImportError: No module named 'triton'", 'capabilities': []}

或者工作流可能会以如下方式失败:

ModuleNotFoundError: No module named 'triton'

启动行通常只是能力报告。工作流失败则不同:某个节点实际尝试导入 triton 并停止了运行。

Triton 在 ComfyUI 中的作用

Triton 是一种 GPU 编程语言和编译器,被 PyTorch 编译器路径、SageAttention 以及一些较新的加速后端等项目所使用。

ComfyUI 进行普通图像生成时不需要 Triton。启用 CUDA 的 PyTorch 无需 Triton 即可运行正常工作流。

Triton 在以下情况下才重要:

  • 使用 SageAttention 或封装了 SageAttention 的节点
  • 使用 torch.compile 或启用了编译内核的自定义节点
  • 使用报告 Triton 能力的 comfy_kitchen 加速后端
  • 明确要求基于 Triton 加速的视频或大模型工作流

如果你不使用上述任何一项,修复 Triton 可能会增加风险而不解决真正的问题。

为什么 SageAttention 和 Triton 相互关联

在 ComfyUI 支持日志中,SageAttention 和 Triton 经常出现在同一修复路径上。

SageAttention 是用户尝试启用的加速功能。Triton 是 SageAttention 或相邻加速代码可能需要用于编译内核的底层包之一。这意味着 SageAttention 安装可能以三种看起来不同的方式失败:

用户目标出现的错误首先使用的页面
启用 SageAttentionNo module named 'sageattention'SageAttention 缺失
在 Windows 上运行 SageAttentionNo module named 'triton'本 Triton 指南
安装加速包后运行视频工作流tcc.exe、triton_key、DLL 或编译器错误先看本 Triton 指南,再看 SageAttention 指南

安全的操作顺序是:确认 ComfyUI 仍能启动,确认确切的 Python 环境,仅在失败的 SageAttention 工作流确实需要 Triton 时才修复它,然后在 Triton 正常工作后验证 SageAttention 导入。

第一步:判断是否为致命错误

首先检查 ComfyUI 是否到达正常的就绪行:

To see the GUI go to: http://127.0.0.1:8188

如果浏览器 UI 能打开且一个简单的默认工作流可以运行,则将 Triton 行视为可选项。在调试正常运行的环境时,不要安装加速包。

如果特定工作流失败,请阅读堆栈跟踪并确认是哪个包请求了 Triton。许多真实报告来自 SageAttention 节点、Wan/LTX 视频工作流或优化节点。

第二步:检查 ComfyUI 实际使用的 Python

大多数失败的修复是因为 pip 安装到了系统 Python,而 ComfyUI 使用的是嵌入式 Python 或虚拟环境。

对于 GitHub Windows 便携版,请从解压后的便携根目录(包含 run_*.bat 文件、python_embeded 和 ComfyUI 的文件夹)运行检查:

.\python_embeded\python.exe -s -c "import sys; print(sys.executable); print(sys.version)"
.\python_embeded\python.exe -s -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.is_available())"
.\python_embeded\python.exe -s -m pip show triton triton-windows

对于手动安装,激活你用于启动 ComfyUI 的 venv:

python -c "import sys; print(sys.executable); print(sys.version)"
python -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.is_available())"
python -m pip show triton triton-windows

如果 torch.cuda.is_available() 返回 False,请先修复 PyTorch/CUDA。Triton 不会将纯 CPU PyTorch 安装变成可用的 CUDA 环境。

对于 ComfyUI Desktop 或其他托管启动器,请使用应用的终端或环境控制。不要假设 GitHub 便携版的 python_embeded 路径在 Desktop 安装中也存在。

第三步:在 Windows 上不要使用普通 triton 包作为修复方案

对于 Windows ComfyUI,实用的包是 triton-windows,而不是盲目执行 pip install triton。

如果你已经安装了旧版或错误的 triton 包,请从同一 Python 环境中将其卸载:

.\python_embeded\python.exe -s -m pip uninstall -y triton

然后安装 triton-windows:

.\python_embeded\python.exe -s -m pip install -U "triton-windows<3.7"

对于手动 venv:

python -m pip uninstall -y triton
python -m pip install -U "triton-windows<3.7"

版本上限是有意为之的,它可以避免在你的 PyTorch 栈尚未准备好之前意外拉取未来的 Triton 次版本。

第四步:匹配 PyTorch 和 Triton 版本

triton-windows 跟踪 Triton 次版本,每个 PyTorch 次版本都预期与匹配的 Triton 次版本协同工作。

如有疑问,请使用上游 triton-windows 兼容性表。以下是实用参考:

PyTorch预期 Triton 次版本
2.63.2
2.73.3
2.83.4
2.93.5
2.10 或 2.113.6

对于使用 Python 3.12 或 3.13 的当前 ComfyUI 便携版或桌面环境,请先检查已安装的 PyTorch,然后选择 Triton 范围。triton-windows PyPI 包提供了适用于近期 CPython 版本的 Windows wheel,但仅靠 Python 版本是不够的,PyTorch、CUDA、GPU 以及需要 Triton 的包也都很重要。

第五步:嵌入式 Python 可能需要 include 和 libs

某些 ComfyUI 便携版使用嵌入式 Python。triton-windows 说明中指出了一个特殊的嵌入式 Python 要求:Python 头文件和库可能需要存在于嵌入式 python.exe 旁边。

重要的细节是文件夹名称:

  • include
  • libs

不要将 libs 与 Lib 混淆。Lib 是正常的 Python 库文件夹,不应为此修复而修改。

如果 Triton 能导入但编译失败,或者错误提到缺少 Python 头文件或库,请按照 triton-windows 嵌入式 Python 部分的说明,获取与你的 Python 次版本匹配的确切 include 和 libs 文件。

第六步:重启 ComfyUI 前先验证

在同一 Python 环境中运行导入测试:

.\python_embeded\python.exe -s -c "import triton; print(triton.__version__)"

然后验证 PyTorch 仍能识别 CUDA:

.\python_embeded\python.exe -s -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.is_available())"

如果导入测试失败,ComfyUI 也会失败。在重启服务器之前,请先修复 Python 环境。

若要进行内核级验证,请使用 triton-windows 仓库中的测试脚本。普通导入只能证明包已安装;内核测试才能证明它可以编译并运行 CUDA 内核。

常见失败情况

错误可能原因修复方法
安装后仍出现 No module named 'triton'Python 环境错误使用便携版内置 Python、启动 venv 或应用托管终端
No module named 'triton.language'; 'triton' is not a package本地名为 triton 的文件/文件夹遮蔽了包重命名该文件/文件夹
DLL load failed缺少运行时依赖或 wheel 不兼容安装 Visual C++ Redistributable 并检查包版本
tcc.exe 编译失败Triton 运行时/编译器不匹配检查 triton-windows 版本和 PyTorch 版本
cannot import triton_key包版本不匹配删除过时的 Triton 包并安装匹配的版本范围
安装加速包前 ComfyUI 正常工作可选包破坏了环境稳定性卸载并恢复到 PyTorch attention

不应执行的操作

  • 不要将 triton 安装到系统 Python 并期望 ComfyUI 便携版能看到它。
  • 不要仅因为启动能力行提到 Triton 就去安装它。
  • 不要混用来自不同指南的随机 SageAttention、PyTorch、CUDA 和 Triton wheel。
  • 除非你确实将 ComfyUI 安装在受保护的系统路径中,否则不要以管理员身份运行包修复操作。
  • 当说明书写的是 libs 时,不要去修改 python_embeded\Lib。

何时跳过 Triton

在以下情况下跳过修复:

  • ComfyUI 能正常打开且工作流可以运行
  • 你使用的是纯 CPU PyTorch
  • 你使用的是 AMD 或 Intel 路径,而失败的节点是为 NVIDIA CUDA 编写的
  • 真正的失败原因是缺少自定义节点、模型文件或 Hugging Face 下载
  • 你无法确认哪个工作流节点实际需要 Triton

如果多个包同时失败,请使用 ComfyUI 常见问题 或 如何修复 ComfyUI 插件导入失败错误。

Wonderful Launcher 如何提供帮助

当环境变得难以分析时,Wonderful Launcher 会很有用:

  • 它将每个安装的 ComfyUI 包分隔开来
  • 它使精确的启动日志更易于收集
  • 它有助于在进行风险较高的修复前保存模型和工作流
  • 它提供了比每次可选后端警告后重新安装 ComfyUI 更安全的路径

如果 Triton 只是一个警告且 ComfyUI 能正常运行,你可能不需要进行修复。如果 Triton 与 SageAttention、PyTorch/CUDA、自定义节点或反复出现的启动失败一起出现,请从日志入手,逐一修复每条依赖路径。

常见问题

comfy_kitchen backend triton 是 ComfyUI 的致命错误吗?

不一定。如果 ComfyUI 能正常打开且工作流可以运行,它通常只是一条可选的后端能力报告。只有当工作流或自定义节点因尝试导入 Triton 而失败时,才将其视为致命错误。

在 Windows 上应该运行 pip install triton 吗?

通常不应该。对于 Windows ComfyUI 修复,请使用 triton-windows 路径并安装到启动 ComfyUI 的确切 Python 环境中。普通的 pip install triton 是一种常见的错误环境或不受支持的包修复方式。

为什么 Easy-SAM3、Trellis 或 WanVideoWrapper 会提到 Triton?

这些工作流可能使用了加速密集型自定义节点。Triton 在依赖链中的位置可能低于可见节点,因此即使普通的 ComfyUI 图像生成仍然正常,工作流也可能失败。

相关指南

  • ComfyUI No Module Named 'sageattention':忽略还是修复?
  • 修复 ComfyUI 中的 No module named 错误
  • ComfyUI 依赖冲突
  • ComfyUI Torch Not Compiled With CUDA Enabled
  • GPU 兼容性
  • ComfyUI 常见问题

来源参考

  • triton-windows GitHub 仓库
  • triton-windows PyPI 包
  • ComfyUI issue:No module named 'triton'
  • ComfyUI issue:Triton 在桌面应用中无法工作
  • ComfyUI 论坛:Windows 上的 comfy_kitchen backend triton
相关指南:Fix SageAttention missing errorsRepair PyTorch CUDA firstAvoid risky package repairs

先按上面的步驟定位根因。还卡住时,可以下载 Wonderful Launcher 检查目前机器;启动器原生修复、任务日誌和執行階段检查会集中在一起。credits 只用於图片生成和按量工具。

下载 Wonderful Launcher查看 credits 方案

这篇文件解決了你的問题嗎?

你的回饋会帮助我们優先補強真實 ComfyUI 排障文件。

ModuleNotFoundError: No module named 'onnx' 或 'onnxruntime'(ComfyUI)

修复 ComfyUI 中 ModuleNotFoundError: No module named 'onnx' 或 'onnxruntime',涵盖 onnxruntime.capi、WanVideoWrapper FantasyPortrait、DWPose、ReActor、IPAdapter FaceID、InstantID 及 PuLID 工作流。

ComfyUI ModuleNotFoundError: No module named 'sageattention' 修复

判断 ComfyUI No module named 'sageattention' 是可忽略的启动 warning,还是 Wan、HunyuanVideo、LTX、Qwen Image 工作流失败;优先切回 SDPA/Comfy,再安全检查 Python、Triton 和 SageAttention。

目录

快速参考
问题分类
如果日志中提到 comfy_kitchen backend triton
日志的样式
Triton 在 ComfyUI 中的作用
为什么 SageAttention 和 Triton 相互关联
第一步:判断是否为致命错误
第二步:检查 ComfyUI 实际使用的 Python
第三步:在 Windows 上不要使用普通 triton 包作为修复方案
第四步:匹配 PyTorch 和 Triton 版本
第五步:嵌入式 Python 可能需要 include 和 libs
第六步:重启 ComfyUI 前先验证
常见失败情况
不应执行的操作
何时跳过 Triton
Wonderful Launcher 如何提供帮助
常见问题
comfy_kitchen backend triton 是 ComfyUI 的致命错误吗?
在 Windows 上应该运行 pip install triton 吗?
为什么 Easy-SAM3、Trellis 或 WanVideoWrapper 会提到 Triton?
相关指南
来源参考