No module named 'onnx' or 'onnxruntime' in ComfyUI
Fix No module named 'onnx' or 'onnxruntime' errors in ComfyUI for WanVideoWrapper, DWPose, ReActor, IPAdapter FaceID, InstantID, and PuLID workflows.
Start with Wonderful Launcher if this issue touches your real ComfyUI environment. Use the docs to understand the fix, and use the app to inspect the machine you already have.
Download Wonderful LauncherIf you searched for ComfyUI no module named onnx WanVideoWrapper, No module named 'onnx', or No module named 'onnxruntime', first check whether the failing workflow actually uses ONNX-backed face, pose, or helper nodes.
For WanVideoWrapper, the warning often appears around FantasyPortrait or video-helper nodes. For most users, CPU onnxruntime is the safer first fix. Use GPU ONNX Runtime only when the workflow needs it and you can match the CUDA/cuDNN stack.
Symptoms
When ComfyUI starts, the terminal log shows warnings or errors like these:
WanVideoWrapper WARNING: FantasyPortrait nodes not available: No module named 'onnx'No module named 'onnxruntime'DWPose: Onnxruntime not found or doesn't come with acceleration providers, switch to OpenCV with CPU deviceCause
onnx is a model interchange library used to load .onnx model files. onnxruntime is the inference engine that runs those models. The two are often needed together, but not every workflow needs both.
Common ComfyUI custom nodes that may depend on ONNX or ONNX Runtime include:
- ComfyUI-WanVideoWrapper - FantasyPortrait and related features
- comfyui_controlnet_aux - DWPose pose detection
- ComfyUI-ReActor - face swap through InsightFace / ONNX Runtime
- ComfyUI_IPAdapter_plus - FaceID through InsightFace
- ComfyUI_InstantID - identity-consistent face generation
- ComfyUI-PuLID - face preservation
When these libraries are missing, nodes that depend on them may be unavailable, while ComfyUI itself and unrelated custom nodes can still work.
Severity
Medium - install these only if your workflow uses ONNX-backed pose, face, or helper models. If the warning is from an optional node family you do not use, it can be safely ignored.
Before installing: use the correct Python
| Install type | Command pattern |
|---|---|
| Official GitHub Windows portable package | From the portable package root: .\python_embeded\python.exe -s -m pip ... |
| Manual Git + venv install | Activate the venv, then run python -m pip ... |
| ComfyUI Desktop or managed launcher | Use 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 after installation.
Solutions
Option 1: Install the CPU version
This is the safest first choice for most users:
python -m pip install onnx onnxruntimeFor the official Windows portable package:
.\python_embeded\python.exe -s -m pip install onnx onnxruntimeThis is sufficient for many use cases. Features like DWPose can work in CPU mode, just slower.
Option 2: Install the GPU-accelerated version
If you have an NVIDIA GPU and the workflow benefits from ONNX Runtime GPU acceleration:
python -m pip install onnx onnxruntime-gpuDo not keep both onnxruntime and onnxruntime-gpu installed at the same time. If you previously installed the CPU package, remove it first:
python -m pip uninstall onnxruntime -y
python -m pip install onnxruntime-gpuCommon installation issues
GPU not working after installing onnxruntime-gpu
Error message:
[W:onnxruntime:Default, onnxruntime_pybind_state.cc] LoadLibrary failed with error 126 when trying to load onnxruntime_providers_cuda.dllCause: The CUDA/cuDNN family required by onnxruntime-gpu does not match the runtime stack used by PyTorch.
ONNX Runtime's CUDA provider has different compatibility groups. Current CUDA 12.x ONNX Runtime packages use cuDNN 9.x and are compatible with newer PyTorch CUDA 12.x stacks, while older PyTorch builds may need older ONNX Runtime GPU versions.
Safer fix: Use CPU onnxruntime unless the workflow is clearly bottlenecked by ONNX inference. If you need GPU acceleration, match ONNX Runtime GPU to your PyTorch CUDA/cuDNN family instead of installing the latest package blindly.
Both onnxruntime and onnxruntime-gpu installed
Symptom: GPU inference fails to activate, or behavior becomes inconsistent.
Check what is installed:
python -m pip list | findstr onnxruntimeIf both are present, keep only the version you need:
python -m pip uninstall onnxruntime onnxruntime-gpu -y
python -m pip install onnxruntimeor, for GPU:
python -m pip uninstall onnxruntime onnxruntime-gpu -y
python -m pip install onnxruntime-gpuprotobuf version conflict
Error message:
TypeError: Descriptors cannot be created directly.Solution: Quote the requirement so shells do not interpret > as redirection:
python -m pip install "protobuf>=3.20"Verify the installation
python -c "import onnxruntime as ort; print(ort.__version__, ort.get_available_providers())"If GPU acceleration is working, CUDAExecutionProvider should appear in the provider list. If only CPUExecutionProvider appears, the CPU package is installed or the GPU provider did not load.
Still not resolved?
If you encounter other errors during installation, collect the full terminal message plus:
- output of
python --version - output of
python -c "import torch; print(torch.__version__, torch.version.cuda)" - output of
python -c "import onnxruntime as ort; print(ort.__version__, ort.get_available_providers())"
Then use expert help if you need the fastest recovery path.
Source References
Start with Wonderful Launcher if this issue touches your real ComfyUI environment. Use the docs to understand the fix, and use the app to inspect the machine you already have.
Download Wonderful LauncherStart with Wonderful Launcher if this issue touches your real ComfyUI environment. Use the docs to understand the fix, and use the app to inspect the machine you already have.
Download Wonderful LauncherDid this fix your issue?
Your answer helps prioritize verified ComfyUI repairs.
Transformers Missing
Fix ComfyUI No module named transformers errors in the active Python environment and understand when the failure comes from ComfyUI's core text stack.
Triton Missing
Fix ModuleNotFoundError: No module named 'triton' in ComfyUI by separating harmless comfy_kitchen logs from blocking workflow or SageAttention failures.