LogoWonderful Launcher
  • Home
  • Pricing
  • Docs
  • Download

ModuleNotFoundError: No module named 'onnx' or 'onnxruntime' in ComfyUI

Partially verifiedMedium riskTested on Windows 10, Windows 11 | portable | Python 3.11 | CUDA 12.x | Torch 2.x | ComfyUI portable and manual venv patternsLast verified 2026-07-08Estimated time 5-20 minutes

Fix ModuleNotFoundError: No module named 'onnx' or 'onnxruntime' in ComfyUI, including onnxruntime.capi, WanVideoWrapper FantasyPortrait, DWPose, ReActor, IPAdapter FaceID, InstantID, and PuLID workflows.

No module named 'onnx' and No module named 'onnxruntime' appear when an ONNX-backed face, pose, or helper node cannot import its backend. First check whether the failing workflow actually uses ONNX nodes. onnx loads .onnx model files; onnxruntime runs them — they are related but not the same, and not every workflow needs both.

WanVideoWrapper WARNING: FantasyPortrait nodes not available: No module named 'onnx'
No module named 'onnxruntime'
ModuleNotFoundError: No module named 'onnxruntime.capi'
DWPose: Onnxruntime not found or doesn't come with acceleration providers, switch to OpenCV with CPU device

Custom nodes that may need ONNX / ONNX Runtime include ComfyUI-WanVideoWrapper (FantasyPortrait), comfyui_controlnet_aux (DWPose), ComfyUI-ReActor, ComfyUI_IPAdapter_plus, ComfyUI_InstantID, and ComfyUI-PuLID. When missing, those nodes are unavailable while the rest of ComfyUI still works.

Severity: medium — install only if your workflow uses ONNX-backed pose, face, or helper models. A warning from an optional node family you do not use can be ignored.

Triage: pick the right ONNX branch

Your newest error saysWhat it points toSafer first fix
No module named 'onnx'Cannot parse/use ONNX model metadataInstall onnx in the ComfyUI Python
No module named 'onnxruntime'Cannot run ONNX inferenceInstall CPU onnxruntime first unless GPU ONNX is required
No module named 'onnxruntime.capi'ONNX Runtime missing, broken, or shadowedReinstall one ONNX Runtime package in the active Python
LoadLibrary failed ... onnxruntime_providers_cuda.dllGPU ONNX Runtime provider mismatchMatch ONNX Runtime GPU with CUDA/cuDNN/PyTorch; do not keep reinstalling
DWPose falls back / ONNX acceleration unavailablePose preprocessor can run CPU modeUse CPU mode first, optimize only if too slow
Both onnxruntime and onnxruntime-gpu installedConflicting runtime packagesKeep only one runtime package

Stay anchored to the newest error. Do not switch to an older package family just because a previous log line mentioned a different plugin.

Need a safer repair path?

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 path

Use the correct Python

Install typeCommand pattern
Official GitHub Windows portable packageFrom the portable package root: .\python_embeded\python.exe -s -m pip ...
Manual Git + venv installActivate the venv, then run python -m pip ...
ComfyUI Desktop or managed launcherUse the app's environment/terminal tools. Do not assume a portable python_embeded folder exists.

Plain pip install from a random terminal is the most common reason the error stays. If a tool asks for a package name, enter onnxruntime or onnx, not pip install onnxruntime.

Option 1: Install the CPU version (safest first choice)

python -m pip install onnx onnxruntime

For the official Windows portable package:

.\python_embeded\python.exe -s -m pip install onnx onnxruntime

This is enough for many use cases; features like DWPose work in CPU mode, just slower.

Option 2: Install the GPU version

For an NVIDIA GPU where the workflow benefits from ONNX Runtime GPU acceleration:

python -m pip install onnx onnxruntime-gpu

Do not keep both onnxruntime and onnxruntime-gpu installed. If you had the CPU package, remove it first:

python -m pip uninstall onnxruntime -y
python -m pip install onnxruntime-gpu

Common installation issues

GPU not working after installing onnxruntime-gpu:

[W:onnxruntime:Default, onnxruntime_pybind_state.cc] LoadLibrary failed with error 126 when trying to load onnxruntime_providers_cuda.dll

The CUDA/cuDNN family required by onnxruntime-gpu does not match PyTorch's runtime stack. Use CPU onnxruntime unless the workflow is clearly bottlenecked by ONNX inference; if you need GPU, match ONNX Runtime GPU to your PyTorch CUDA/cuDNN family instead of installing the latest package blindly.

Both onnxruntime and onnxruntime-gpu installed: check with python -m pip list | findstr onnxruntime, then keep only the one you need:

python -m pip uninstall onnxruntime onnxruntime-gpu -y
python -m pip install onnxruntime

protobuf version conflict (TypeError: Descriptors cannot be created directly.) — quote the requirement so shells do not interpret >:

python -m pip install "protobuf>=3.20"

Verify

python -c "import onnxruntime as ort; print(ort.__version__, ort.get_available_providers())"

If GPU acceleration works, CUDAExecutionProvider appears. If only CPUExecutionProvider appears, the CPU package is installed or the GPU provider did not load.

Source References

  • ComfyUI troubleshooting overview
  • ComfyUI custom node troubleshooting guide
  • ComfyUI model troubleshooting guide
  • ONNX Runtime installation documentation
Related guides:Start from the No module named hubFix InsightFace workflowsRepair dependency conflicts

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 packages

Did this fix your issue?

Your answer helps prioritize verified ComfyUI repairs.

Table of Contents

Triage: pick the right ONNX branch
Use the correct Python
Option 1: Install the CPU version (safest first choice)
Option 2: Install the GPU version
Common installation issues
Verify
Source References