vllm-project/vllm · error · SystemExit

PyYAML is required. Install it with: pip install pyyaml

Error message

PyYAML is required. Install it with: pip install pyyaml

What it means

recipe_json_to_vllm_config.py imports yaml at module load to parse downloaded recipe YAML. If PyYAML is not installed in the active environment, the import fails and the script immediately exits with this SystemExit message instead of a traceback.

Source

Thrown at tools/recipes/recipe_json_to_vllm_config.py:58

deployment, it exits instead of silently generating an incomplete config.
"""

from __future__ import annotations

import argparse
import difflib
import json
import shlex
import sys
import urllib.parse
import urllib.request
from pathlib import Path
from typing import Any

try:
    import yaml
except ImportError as exc:
    raise SystemExit("PyYAML is required. Install it with: pip install pyyaml") from exc


DEFAULT_API_BASE = "https://recipes.vllm.ai"

SHORT_ALIASES = {
    "-tp": "tensor-parallel-size",
    "-pp": "pipeline-parallel-size",
    "-dp": "data-parallel-size",
}


def parse_args() -> argparse.Namespace:
    p = argparse.ArgumentParser(
        description="Convert vLLM Recipes JSON to native vllm serve config.yml + env.sh"
    )
    p.add_argument(
        "source",
        nargs="?",

View on GitHub (pinned to c794754062)

Solutions

  1. Install it into the interpreter you are using: `uv pip install pyyaml` (or `pip install pyyaml`).
  2. Run the tool from the vLLM development venv where requirements are already installed.

Example fix

# before
python tools/recipes/recipe_json_to_vllm_config.py ...
# -> PyYAML is required. Install it with: pip install pyyaml

# after
uv pip install pyyaml && python tools/recipes/recipe_json_to_vllm_config.py ...
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util, sys
if importlib.util.find_spec("yaml") is None:
    raise SystemExit("PyYAML missing; run: uv pip install pyyaml")

Prevention

When it happens

Trigger: Running the tool with a Python interpreter that lacks the pyyaml package (bare venv, system python without extras).

Common situations: Running the recipe converter outside the vLLM dev venv; minimal containers where only vllm and hard deps were installed.

Related errors


AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14). Data as JSON: /api/errors/15cddba6e58934b1. Report an issue: GitHub.