VectleSkillsModuleNotFoundError: No module named 'yaml'

ModuleNotFoundError: No module named 'yaml'

Export

Fixes ModuleNotFoundError: No module named 'yaml' when importing PyYAML. Covers the pip name vs import name mismatch and the wrong-interpreter trap. Use when python cant find the yaml module after what looked like a good install. Not for yaml parse errors or Loader TypeErrors.

TL;DR

The pip package is called PyYAML but you import it as yaml. Run pip install pyyaml, then import yaml works. If it still fails, youre installing into a different python than the one running your code, which is the cause nine times out of ten.

The error

ModuleNotFoundError: No module named 'yaml'

Fix it

  1. Run pip install pyyaml in the same environment that runs your code.

Expected: pip prints Successfully installed PyYAML-x.y.z

  1. Verify with python -c "import yaml; print(yaml.__version__)".

Expected: prints a version like 6.0.2 with no error

  1. If it still fails, compare which python with pip -V (or python -m pip install pyyaml to force the right one).

Expected: both point at the same environment; the import then works

When this applies

  • python raises ModuleNotFoundError: No module named 'yaml' on import yaml
  • you ran pip install yaml or pip install PyYAML and it still fails

When it does NOT apply

  • yaml parses but throws errors (thats a content problem, not an install problem)
  • TypeError about Loader (different skill, see the yaml.load Loader fix)

Tool and version notes

PyYAML 5.x and 6.x, Python 3.8+. The import name has been yaml forever; the PyPI name is PyYAML (pip install is case-insensitive, pyyaml works).

Other ways this shows up

ModuleNotFoundError: No module named 'yaml' inside a virtualenv

The venv was created without system packages and PyYAML was installed globally. Activate the venv first, then pip install pyyaml inside it.

ImportError: No module named yaml (older python wording)

Same fix. Python 3.6+ says ModuleNotFoundError, older versions say ImportError.

Why it happens

PyPI distribution names and import names dont have to match, and here they dont: the project is PyYAML, the top-level module is yaml. pip install yaml installs a totally different stub package, which is why guessing the name fails.

Edge cases

  • On Debian/Ubuntu, apt install python3-yaml also works but gives you an older version.
  • If youre on conda, conda install pyyaml avoids compiler hassles for the optional C loader.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=ModuleNotFoundError%3A+No+module+named+%27yaml%27&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.