ComfyUI: ModuleNotFoundError: No module named 'insightface' (fix)

ModuleNotFoundError: No module named 'insightface' in ComfyUI means a face custom node (InstantID here) was cloned without installing its requirements into ComfyUI's Python. We reproduced it on v0.37.0 and fixed it with no compiler.

1. The error

ComfyUI v0.37.0 (CPython 3.11, torch 2.9.0+cpu) with ComfyUI_InstantID (commit 72495e8) cloned into custom_nodes/ but its requirements not installed, python main.py --cpu:

[WARNING] Traceback (most recent call last):
  File "ComfyUI/nodes.py", line 2266, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "ComfyUI/custom_nodes/ComfyUI_InstantID/__init__.py", line 1, in <module>
    from .InstantID import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "ComfyUI/custom_nodes/ComfyUI_InstantID/InstantID.py", line 13, in <module>
    from insightface.app import FaceAnalysis
ModuleNotFoundError: No module named 'insightface'

[WARNING] Cannot import ComfyUI/custom_nodes/ComfyUI_InstantID module for custom nodes: No module named 'insightface'
[INFO] ComfyUI-GGUF: Allowing full torch compile
[INFO] 
Import times for custom nodes:
[INFO]    0.0 seconds: ComfyUI/custom_nodes/websocket_image_save.py
[INFO]    0.0 seconds (IMPORT FAILED): ComfyUI/custom_nodes/ComfyUI_InstantID

ComfyUI keeps running (exit code 0); only the custom node is skipped, so its nodes (InstantIDFaceAnalysis, ApplyInstantID ...) show up as missing when you load a workflow. InstantID.py does from insightface.app import FaceAnalysis at the top, so the whole node fails to import. Other face nodes that use insightface fail the same way.

2. Fix: install the node's requirements into ComfyUI's Python

cd ComfyUI/custom_nodes/ComfyUI_InstantID
python -m pip install -r requirements.txt

The requirements file lists insightface, onnxruntime and (on x86_64 Linux/Windows) onnxruntime-gpu. Here it installed insightface 2.1, onnxruntime 1.31.0, onnx 1.23.2, opencv-python 5.0.0.93 and scikit-image 0.26.0 in 12 seconds, with no compiler involved. After a restart the node loaded:

Import times for custom nodes:
[INFO]    0.0 seconds: ComfyUI/custom_nodes/websocket_image_save.py
[INFO]    0.0 seconds: ComfyUI/custom_nodes/ComfyUI-GGUF
[INFO]    0.1 seconds: ComfyUI/custom_nodes/ComfyUI_InstantID
[INFO]

Use the Python that runs main.py: activate the venv first, or on the Windows portable build run ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt from the node folder. A pip belonging to another Python puts insightface where ComfyUI never looks.

3. "Failed building wheel for insightface"

Older tutorials pin insightface==0.7.3. On PyPI that release is only a source archive (insightface-0.7.3.tar.gz), so pip has to compile it, which is typically where which is where "Microsoft Visual C++ 14.0 or greater is required" and similar build errors come fromquot;Microsoft Visual C++ 14.0 or greater is requiredwhich is where "Microsoft Visual C++ 14.0 or greater is required" and similar build errors come fromquot; and similar build errors come from on Windows. Releases 2.0 and 2.1 ship a py3-none-any wheel and require Python 3.10 or newer; on Python 3.9 pip picked the 1.0.1 wheel instead. Unless a node pins 0.7.3 for a reason, install the unpinned package and pip uses a wheel.

Related: ComfyUI: No module named 'gguf' · ComfyUI: No module named 'av' · ComfyUI-Manager: Bad git executable · ComfyUI: No module named 'onnxruntime' · onnxruntime has no attribute InferenceSession

Frequently asked questions

Does ComfyUI stop when insightface is missing?

No. ComfyUI starts; only the custom node that imports insightface is marked IMPORT FAILED and its nodes are missing.

Do I need Visual C++ to install insightface?

Not for insightface 2.x: it ships a pure-Python wheel (Python 3.10+). Only the old 0.7.3 release, published as source only, needs a compiler.

Written with AI assistance. Measured on 2026-10-24 on Linux, CPython 3.11.17: ComfyUI v0.37.0, torch 2.9.0+cpu, ComfyUI_InstantID at commit 72495e8, without and with insightface 2.1. Wheel check on CPython 3.9.25. Output pasted unedited except shortened paths. PlainTables is our extension; ComfyUI, ComfyUI_InstantID and insightface are free.