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

ModuleNotFoundError: No module named 'ultralytics' in ComfyUI comes from ComfyUI-Impact-Subpack (UltralyticsDetectorProvider) when its requirements were not installed into ComfyUI's Python. We reproduced it on v0.37.0 and fixed it.

1. The error

ComfyUI v0.37.0 (CPython 3.11, torch 2.9.0+cpu) with ComfyUI-Impact-Subpack V1.3.5 (commit 50c7b71) cloned into custom_nodes/, requirements not installed. The node prints its own error box first:

[ERROR] No module named 'ultralytics'
[ERROR] 
!!!!!

[ComfyUI-Impact-Subpack] If this error occurs, please check the following link:
	https://github.com/ltdrdata/ComfyUI-Impact-Pack/blob/Main/troubleshooting/TROUBLESHOOTING.md

!!!!!

then ComfyUI's traceback (shortened) and the startup summary:

[WARNING] Traceback (most recent call last):
  ...
  File "ComfyUI/custom_nodes/ComfyUI-Impact-Subpack/modules/subpack_nodes.py", line 3, in <module>
    from . import subcore
  File "ComfyUI/custom_nodes/ComfyUI-Impact-Subpack/modules/subcore.py", line 150, in <module>
    from ultralytics import YOLO
ModuleNotFoundError: No module named 'ultralytics'

[WARNING] Cannot import ComfyUI/custom_nodes/ComfyUI-Impact-Subpack module for custom nodes: No module named 'ultralytics'
[INFO]    0.0 seconds (IMPORT FAILED): ComfyUI/custom_nodes/ComfyUI-Impact-Subpack

ComfyUI keeps running (exit code 0), but the Subpack's nodes such as UltralyticsDetectorProvider are missing, so workflows that use them load with missing nodes. modules/subcore.py imports ultralytics (plus dill and numpy) inside a try block that logs the box above and re-raises.

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

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

requirements.txt lists matplotlib, ultralytics>=8.3.162, numpy, opencv-python-headless and dill. Here it added ultralytics 8.4.186, dill 0.4.1, matplotlib 3.11.2 and polars 2.0.0 (torch was already there, so it was not reinstalled). After a restart:

[INFO] ### Loading: ComfyUI-Impact-Subpack (V1.3.5)
[INFO] [Impact Subpack] ultralytics_bbox: ComfyUI/models/ultralytics/bbox
[INFO] [Impact Subpack] ultralytics_segm: ComfyUI/models/ultralytics/segm
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]    0.4 seconds: ComfyUI/custom_nodes/ComfyUI-Impact-Subpack

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.

Related: Ultralytics YOLO: Weights only load failed · ComfyUI: No module named 'insightface' · ComfyUI: No module named 'gguf' · ComfyUI: No module named 'yaml' (wrong Python) · ComfyUI: No module named 'cv2'

Frequently asked questions

Which node needs ultralytics?

ComfyUI-Impact-Subpack, which provides UltralyticsDetectorProvider for Impact Pack detailers.

Does ComfyUI stop when ultralytics is missing?

No. ComfyUI starts; only Impact Subpack is marked IMPORT FAILED and its nodes are missing from workflows.

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-Impact-Subpack V1.3.5 at commit 50c7b71, without and with ultralytics 8.4.186. Output pasted unedited except shortened paths and a trimmed traceback. PlainTables is our extension; ComfyUI, Impact Subpack and ultralytics are free (ultralytics is AGPL-3.0).