Reference only

No module named yaml, PIL or pydantic_settings: check the distribution name

Match the import name to its distribution before changing the Python environment that runs ComfyUI.

Start with the name, not a reinstall

An import name is not necessarily a package-install name. The relevant pairs are yaml → PyYAML, PIL → Pillow, and pydantic_settings → pydantic-settings. PyPA explains the naming distinction; the project documentation identifies these distributions.1234

Check the module named in the traceback

Use the exact interpreter that launches the failing ComfyUI instance. Here, python means that interpreter, not whichever executable happens to be on PATH. If the traceback names yaml, check its distribution and then test the import in that same interpreter:

python -m pip show PyYAML
python -c "import yaml; print(yaml.__file__)"

For PIL, substitute Pillow in pip show and PIL in the import test; for pydantic_settings, use pydantic-settings and pydantic_settings. Check only the name in the traceback. pip show reports distribution metadata, while the import test checks whether the current interpreter can load the module. For a missing distribution, consult the failing node's dependency declaration before choosing a compatible version. For an installed distribution that still fails to import, compare its location, the actual interpreter and the complete traceback before changing packages.

When to stop installing

After any one relevant change, retry the specific failed import and restart the original instance. A new settings-validation exception belongs to a different branch; repeatedly reinstalling a present package is not an investigation. A local file named yaml.py is a useful clue, not permission to delete unrelated files.

Record three separate outcomes: the import succeeds, the node registers, and the original task completes. This guide does not establish a universal compatible version or automatically install a package guessed from an error message.

Source and language review: 2026-09-26. No site-run package installation, ComfyUI import failure or GPU test is claimed.

Didn't solve it?

Check the next possible cause

The same symptom can come from a different cause. Work through these related entries in order.

  1. Where to run ComfyUI commands: PowerShell, CMD and virtual environmentsIdentify the shell, interpreter and working directory before copying an installation command.
  2. Keep a reproducible ComfyUI repair record without exposing secretsCapture the environment and one controlled change while distinguishing metadata from runtime success.
Paste your full log into the error finder

Was this page helpful?

Anonymous. Only a yes/no counter is stored; no account, IP address or device details.

Sources & references

Reviewed PyPA package naming, PyYAML, Pillow and Pydantic Settings references on 2026-09-26. No site-run package installation, ComfyUI import failure or GPU test is claimed.

01PyPA: distribution packages and import packagesSource checked: 2026-09-2602Pillow installationSource checked: 2026-09-2603PyYAML documentationSource checked: 2026-09-2604Pydantic Settings documentationSource checked: 2026-09-26

Report an issue · 95b2df7f-3733-5ba6-aaab-4649fea926ca