vllm-project/vllm · warning · RuntimeError

Could not collect pip list output (pip or uv module not avai

Error message

Could not collect pip list output (pip or uv module not available)

What it means

collect_env.py builds an environment report and lists key packages by shelling out to pip list --format=freeze. It first tries importlib.util.find_spec('pip'); if pip is absent it falls back to `uv pip list` but only when running inside a uv-managed venv (is_uv_venv()). If neither holds, it cannot enumerate packages and raises RuntimeError.

Source

Thrown at vllm/collect_env.py:666

    if patterns is None:
        patterns = DEFAULT_PIP_PATTERNS

    def run_with_pip():
        try:
            import importlib.util

            pip_spec = importlib.util.find_spec("pip")
            pip_available = pip_spec is not None
        except ImportError:
            pip_available = False

        if pip_available:
            cmd = [sys.executable, "-mpip", "list", "--format=freeze"]
        elif is_uv_venv():
            print("uv is set")
            cmd = ["uv", "pip", "list", "--format=freeze"]
        else:
            raise RuntimeError(
                "Could not collect pip list output (pip or uv module not available)"
            )

        out = run_and_read_all(run_lambda, cmd)
        return "\n".join(
            line for line in out.splitlines() if any(name in line for name in patterns)
        )

    pip_version = "pip3" if sys.version[0] == "3" else "pip"
    out = run_with_pip()
    return pip_version, out


def get_cachingallocator_config():
    ca_config = os.environ.get("PYTORCH_CUDA_ALLOC_CONF", "")
    return ca_config

View on GitHub (pinned to c794754062)

Solutions

  1. Install pip into the active venv: `uv pip install pip` or ensure the venv is created by uv so is_uv_venv() matches
  2. Recreate the environment with standard tooling (python -m venv with pip, or uv venv) so one of the two detection branches succeeds
  3. If you only need the report, run collect_env from an environment that has pip, pointing at the same vLLM install

Example fix

# before: venv created with --without-pip, not a uv venv
$ python -m vllm.collect_env   # RuntimeError
# after
$ uv pip install pip
$ python -m vllm.collect_env
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util, sys
pip_ok = importlib.util.find_spec("pip") is not None
# plus uv-venv check; run collect_env only if pip_ok or uv venv

Try / catch

try:
    from vllm import collect_env
    report = collect_env.get_env()  # or CLI equivalent
except RuntimeError as e:
    if "pip list" in str(e):
        report = "package listing unavailable"
    else:
        raise

Prevention

When it happens

Trigger: Running vllm.collect_env in a venv with pip deliberately stripped (e.g. uv venv without pip installed, python -m venv --without-pip), or a container where pip was removed, and the venv layout does not look like a uv venv.

Common situations: Docker images that delete pip to slim the image; uv-managed environments whose VIRTUAL_ENV/pyvenv.cfg markers differ from what is_uv_venv() expects; slim distroless-style runtimes.

Related errors


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