报错
026
依赖缺失与自定义节点安装失败
有来源可查
报错 ImportError: DLL load failed while importing onnxruntime_pybind11_state(缺 Visual C++ 运行库 / onnxruntime 版本不匹配)
报错原文(原样)
Cannot import C:\ComfyUI\custom_nodes\ComfyUI-WD14-Tagger module for custom nodes: DLL load failed while importing onnxruntime_pybind11_state (注:以上为转述文本,非逐字原文。)
检索关键词
DLL load failed while importing onnxruntime_pybind11_state、onnxruntime_pybind11_state、IMPORT FAILED、ComfyUI-WD14-Tagger、vcruntime140、Visual C++ 运行库
先看这一句
依赖 onnxruntime 的节点(如 WD14-Tagger、部分 ControlNet 预处理器、人脸/分割节点)启动即导入失败,日志出现 (IMPORT FAILED);用户常已反复升降 onnxruntime 版本但无效。
适用版本 全版本通用;仅 Windows 出现该报错(Linux/macOS 报的是 .so / .dylib 相关错误)
·
核实日期 2026-09-26
·
状态 已核实
适用环境:Windows 便携版、秋叶/绘世整合包、ComfyUI Desktop
现象与触发场景
常见触发场景:
- 全新安装的 Windows 系统,没装过 Microsoft Visual C++ 可再发行组件(VC_redist)
- 换用 onnxruntime-directml 或 onnxruntime-gpu 后与其它包(如 scikit-learn)互相干扰
- 用 pip 反复试多个 onnxruntime 版本(issue 报告者实测 1.17.0 / 1.17.1 / 1.18.0 / 1.18.1 都失败)
根因
- onnxruntime 的 pybind11 扩展是原生 DLL,加载时依赖 VC++ 运行库(vcruntime140 / vcruntime140_1 等),系统缺运行库就会报 DLL 加载失败
- 同名模块被多个变体(onnxruntime、onnxruntime-gpu、onnxruntime-directml)覆盖安装,DLL 与 Python 扩展版本不一致
- 依赖包(如 sklearn)先加载了另一份 onnxruntime DLL,造成导入冲突
解决步骤
已按「最可能有效」排序。请从上往下做,每做完一步用「验证」确认,不要一次改五处。
- 安装 Microsoft Visual C++ 可再发行组件(VC_redist)装 Visual C++ Redistributable(x64 最新版)后重启系统再启动 ComfyUI。这与“编译需要 Build Tools”是两件事:运行现成 DLL 只需要运行库,编译源码才需要 Build Tools。
- 只保留一份 onnxruntime 变体先卸载所有 onnxruntime 变体,再只装一个与需求匹配的版本(GPU 加速装 onnxruntime-gpu,DirectML 装 onnxruntime-directml,其余装 onnxruntime),避免多份 DLL 互相覆盖。..\..\python_embeded\python.exe -m pip uninstall -y onnxruntime onnxruntime-gpu onnxruntime-directml..\..\python_embeded\python.exe -m pip install onnxruntime
- 让该节点自己装依赖WD14-Tagger 等节点仓库在 issue 中并未给出“换某个 onnxruntime 版本就好”的结论(报告者试了 4 个版本仍失败),因此不要盲目升降版本;先用 ComfyUI 解释器装节点 requirements,再按上面两步处理运行库与变体冲突。
验证是否修好
重启 ComfyUI 后该节点不再出现 (IMPORT FAILED);在界面里跑一次 WD14 Tagger 打标或对应预处理,能正常输出结果。
补充说明
error_text_verbatim 标记为 false:原始 issue 中 “Cannot import ... module for custom nodes:” 与 “DLL load failed while importing onnxruntime_pybind11_state” 是日志中前后两段文本,此处为便于检索合并书写,用户实际看到的措辞可能略有差异。此外,本机(采集环境)triton 未安装,日志中另有 ImportError: No module named 'triton',性质相同。
来源
按可信度排列:官方 issue / 官方文档 > 节点仓库 issue > 社区帖 > 中文社区文章。
链接以纯文本给出(本站不做站外跳转),需要核对时请自行复制到浏览器打开。
- [73] (节点仓库 issue) (IMPORT FAILED): C:\ComfyUI\custom_nodes\ComfyUI-WD14-Tagger · Issue # https://github.com/pythongosssss/ComfyUI-WD14-Tagger/issues/65
- [74] (官方 issue) Importing onnxruntime_pybind11_state fails in Windows Python 3.10 · Is https://github.com/microsoft/onnxruntime/issues/16116
本条报错提到的节点仓库
下面这些节点仓库的名字出现在本条报错的正文里。这里只说「名字出现过」,没有断定问题就是它引起的; 点进去可以看这个包的用途、适配模型与下载量。
这条报错要用到的东西
按本条报错所属的类别(依赖缺失与自定义节点安装失败)列出站内相关的下载包与板块入口。 它们不是「必须下载才能修好」,而是这一类问题里最常要动到的东西;具体怎么做,以上面的解决步骤为准。
常用节点速查包常用节点参数小抄 / 常见连法示意图
待挂载
节点库按用途找节点仓库,附适配模型与下载量
板块
同一类别的其他条目
【023】报错 No module named 'insightface'(IPAdapter 人脸加载器 / ReActor 换脸节点不可用)
有来源
【024】一个节点包报错导致 / 或看似导致所有自定义节点加载中断(Cannot import ... custom_nodes)
有来源
【025】报错 No module named 'cv2'(controlnet_aux / WanVideoWrapper 等节点导入失败)
有来源
【027】报错 ImportError: cannot import name 'cached_download' from 'huggingface_hub'(diffusers 与新版 huggingface_hub 不兼容)
有来源
【028】工作流加载后提示缺少节点 / 节点显示红色(Warning: Missing Node Types)
有来源
这个解法对你有效吗
记录只存在你自己的浏览器里,不需要注册账号。
知仓学习社