ComfyUI: ModuleNotFoundError: No module named 'av' (fix)
ModuleNotFoundError: No module named 'av' stops ComfyUI at startup. We reproduced it on v0.37.0, fixed it, and also hit the two follow-up errors: an old PyAV (cannot import name 'ColorPrimaries') and Python 3.9 (no matching av>=17.0.0).
1. The error
ComfyUI v0.37.0 on CPython 3.11 with torch 2.9.0+cpu and every requirement installed except av (PyAV), python main.py --cpu:
Traceback (most recent call last):
File "ComfyUI/main.py", line 251, in <module>
import execution
File "ComfyUI/execution.py", line 25, in <module>
import nodes
File "ComfyUI/nodes.py", line 31, in <module>
from comfy_api.version_list import supported_versions
File "ComfyUI/comfy_api/version_list.py", line 1, in <module>
from comfy_api.latest import ComfyAPI_latest
File "ComfyUI/comfy_api/latest/__init__.py", line 6, in <module>
from ._input import ImageInput, AudioInput, MaskInput, LatentInput, VideoInput
File "ComfyUI/comfy_api/latest/_input/__init__.py", line 4, in <module>
from .video_types import VideoInput
File "ComfyUI/comfy_api/latest/_input/video_types.py", line 6, in <module>
import av
ModuleNotFoundError: No module named 'av'
ComfyUI exits before the server starts: nodes.py imports comfy_api, whose video input types import PyAV at the top. av is in requirements.txt (since v0.3.15; av>=17.0.0 in v0.37.0 and v0.38.0), so this happens when the install skipped the requirements file, e.g. after git pull without re-running pip install -r requirements.txt, or when pip ran in a different Python than the one starting ComfyUI.
2. Fix: install the requirements into the Python that runs ComfyUI
cd ComfyUI
python -m pip install -r requirements.txt
# or only PyAV:
python -m pip install "av>=17.0.0"
Use the same python that runs main.py (the portable build: python_embeded\python.exe -m pip ...). With av 18.1.0 installed, the same command started normally and --quick-test-for-ci exited with status 0.
3. Old PyAV: cannot import name 'ColorPrimaries'
If an older PyAV is already installed, the error moves one line down. Same setup with av 14.2.0:
Traceback (most recent call last):
File "ComfyUI/main.py", line 251, in <module>
import execution
File "ComfyUI/execution.py", line 25, in <module>
import nodes
File "ComfyUI/nodes.py", line 31, in <module>
from comfy_api.version_list import supported_versions
File "ComfyUI/comfy_api/version_list.py", line 1, in <module>
from comfy_api.latest import ComfyAPI_latest
File "ComfyUI/comfy_api/latest/__init__.py", line 7, in <module>
from ._input_impl import VideoFromFile, VideoFromComponents, VideoFromList
File "ComfyUI/comfy_api/latest/_input_impl/__init__.py", line 1, in <module>
from .video_types import VideoFromFile, VideoFromComponents, VideoFromList
File "ComfyUI/comfy_api/latest/_input_impl/video_types.py", line 4, in <module>
from av.video.reformatter import ColorPrimaries, ColorRange, ColorTrc
ImportError: cannot import name 'ColorPrimaries' from 'av.video.reformatter' (venv/lib/python3.11/site-packages/av/video/reformatter.cpython-311-x86_64-linux-gnu.so)
ColorPrimaries is missing from av 16.1.0 and present from 17.0.0, which matches the av>=17.0.0 pin. python -m pip install -U "av>=17.0.0" fixes it.
4. Python 3.9: no matching distribution for av>=17.0.0
PyAV 16 and 17 require Python 3.10+, 18 requires 3.11+, 19 requires 3.12+. On Python 3.9, pip cannot install the version ComfyUI asks for:
ERROR: Ignored the following versions that require a different python version: 16.0.0 Requires-Python >=3.10; 16.0.1 Requires-Python >=3.10; 16.1.0 Requires-Python >=3.10; 17.0.0 Requires-Python >=3.10; 17.0.1 Requires-Python >=3.10; 17.1.0 Requires-Python >=3.10; 18.0.0 Requires-Python >=3.11; 18.1.0 Requires-Python >=3.11; 19.0.0 Requires-Python >=3.12; 19.0.1 Requires-Python >=3.12; 19.0.2 Requires-Python >=3.12
ERROR: Could not find a version that satisfies the requirement av>=17.0.0 (from versions: 0.1.0, ..., 14.2.0, 14.4.0, 15.0.0, 15.1.0)
ERROR: No matching distribution found for av>=17.0.0
ComfyUI's own pyproject.toml says requires-python = ">=3.10", so the fix is a new venv on Python 3.10 or newer (3.11+ gets the current PyAV wheels), then reinstall torch and the requirements into it.
Related: ComfyUI: No module named 'comfy.options' · ComfyUI: No module named 'torchaudio' · libtorchaudio.so undefined symbol · No module named pkg_resources
Frequently asked questions
Why does ComfyUI need av?
comfy_api's video input and output types import PyAV, and nodes.py loads comfy_api at startup, so ComfyUI v0.37.0 cannot start without it.
Which av version does ComfyUI need?
v0.37.0 and v0.38.0 pin av>=17.0.0. av 16.1.0 and older lack ColorPrimaries and fail with an ImportError.
Can I use Python 3.9?
No. ComfyUI requires Python 3.10+, and PyAV 17 needs 3.10+ (18 needs 3.11+).
Written with AI assistance. Measured on 2026-10-24 on Linux: ComfyUI v0.37.0 on CPython 3.11.17 with torch 2.9.0+cpu, without av, with av 14.2.0 / 16.1.0 / 17.0.0 / 18.1.0; pip 26.0.1 on CPython 3.9. Output pasted unedited except shortened paths and pip's version list. PlainTables is our extension; ComfyUI and PyAV are free.