LogoWonderful Launcher
  • Home
  • Pricing
  • Docs
  • Download

ModuleNotFoundError: No module named 'yaml' in ComfyUI

Partially verifiedLast verified 2026-07-08

Fix ComfyUI ModuleNotFoundError: No module named 'yaml' — the actual package name is PyYAML, not yaml.

If ComfyUI logs ModuleNotFoundError: No module named 'yaml', the fix is not pip install yaml. The correct package name is PyYAML.

This is one of the most confusing Python packaging mismatches. The import statement is import yaml, but the pip package is called PyYAML. Installing a package literally named yaml from PyPI will either fail or install the wrong thing.

In the Windows portable SEO Lab repair chain, missing yaml appeared after the database dependencies moved forward. Installing PyYAML exposed the next blocker, which confirmed the active ComfyUI Python was the right repair target.

Fast answer

For the GitHub Windows portable package:

.\python_embeded\python.exe -s -m pip install PyYAML
.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build

Do not run pip install yaml — that is a different, outdated package.

What the error looks like

IMPORT FAILED: ComfyUI-SomeNode
Traceback (most recent call last):
  File "...\custom_nodes\ComfyUI-SomeNode\nodes.py", line 2, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'

You may also see it during ComfyUI startup if a configuration loader or custom node uses YAML for config files.

Why it happens

  • The custom node's requirements.txt lists PyYAML but it was never installed
  • A previous environment repair or reinstall removed PyYAML as a side effect
  • You are running ComfyUI in a minimal Python environment that does not include PyYAML
  • ComfyUI's own requirements.txt may include PyYAML, but the portable package setup skipped it

The package name trap

What you typeWhat happens
pip install yamlInstalls a wrong or broken package — do not use this
pip install PyYAMLInstalls the correct package that provides import yaml
pip install pyyamlAlso works — pip package names are case-insensitive

This is a common Python packaging gotcha. The import name (yaml) does not match the package name (PyYAML).

Safe manual fix

Step 1: Check if PyYAML is already installed

.\python_embeded\python.exe -s -m pip show PyYAML

If it shows nothing, the package is missing. If it shows a version, the problem may be that a different Python is launching ComfyUI.

Step 2: Install PyYAML

For Windows portable:

.\python_embeded\python.exe -s -m pip install PyYAML

For a manual venv:

python -m pip install PyYAML

Step 3: Restart and verify

.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build

The IMPORT FAILED line should disappear from the startup log.

When not to run pip install blindly

PyYAML is generally safe to install, but watch for:

  • Version conflicts if a custom node pins a specific PyYAML version
  • The wrong package: pip install yaml installs a completely different, unmaintained package
  • Installing into a system Python instead of the ComfyUI environment

Always verify you are installing into the same Python that launches ComfyUI.

How Wonderful Launcher can help

Wonderful Launcher can help detect and resolve this issue. It knows the correct package name mapping and helps install PyYAML in the right environment without the naming confusion.

Download Wonderful Launcher — it's free and can recover your environment without reinstalling.

Related errors

  • Repair ComfyUI Portable Dependencies One Missing Module At A Time
  • No module named 'PIL' in ComfyUI
  • ComfyUI Plugin Import Failed
  • ComfyUI Dependency Conflicts
  • ComfyUI Startup Failed
  • Plugin Missing Module Warning: When It Is Safe to Ignore

Source References

  • PyYAML on PyPI
  • PyYAML Documentation
  • ComfyUI GitHub

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

What the error looks like
Why it happens
The package name trap
Safe manual fix
Step 1: Check if PyYAML is already installed
Step 2: Install PyYAML
Step 3: Restart and verify
When not to run pip install blindly
How Wonderful Launcher can help
Related errors
Source References