{"record":{"id":"41b07b6234459863","repo":"vllm-project/vllm","slug":"could-not-collect-pip-list-output-pip-or-uv-modul","errorCode":null,"errorMessage":"Could not collect pip list output (pip or uv module not available)","messagePattern":"Could not collect pip list output \\(pip or uv module not available\\)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"warning","filePath":"vllm/collect_env.py","lineNumber":666,"sourceCode":"    if patterns is None:\n        patterns = DEFAULT_PIP_PATTERNS\n\n    def run_with_pip():\n        try:\n            import importlib.util\n\n            pip_spec = importlib.util.find_spec(\"pip\")\n            pip_available = pip_spec is not None\n        except ImportError:\n            pip_available = False\n\n        if pip_available:\n            cmd = [sys.executable, \"-mpip\", \"list\", \"--format=freeze\"]\n        elif is_uv_venv():\n            print(\"uv is set\")\n            cmd = [\"uv\", \"pip\", \"list\", \"--format=freeze\"]\n        else:\n            raise RuntimeError(\n                \"Could not collect pip list output (pip or uv module not available)\"\n            )\n\n        out = run_and_read_all(run_lambda, cmd)\n        return \"\\n\".join(\n            line for line in out.splitlines() if any(name in line for name in patterns)\n        )\n\n    pip_version = \"pip3\" if sys.version[0] == \"3\" else \"pip\"\n    out = run_with_pip()\n    return pip_version, out\n\n\ndef get_cachingallocator_config():\n    ca_config = os.environ.get(\"PYTORCH_CUDA_ALLOC_CONF\", \"\")\n    return ca_config\n\n","sourceCodeStart":648,"sourceCodeEnd":684,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/collect_env.py#L648-L684","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install pip into the active venv: `uv pip install pip` or ensure the venv is created by uv so is_uv_venv() matches","Recreate the environment with standard tooling (python -m venv with pip, or uv venv) so one of the two detection branches succeeds","If you only need the report, run collect_env from an environment that has pip, pointing at the same vLLM install"],"exampleFix":"# before: venv created with --without-pip, not a uv venv\n$ python -m vllm.collect_env   # RuntimeError\n# after\n$ uv pip install pip\n$ python -m vllm.collect_env","handlingStrategy":"validation","validationCode":"import importlib.util, sys\npip_ok = importlib.util.find_spec(\"pip\") is not None\n# plus uv-venv check; run collect_env only if pip_ok or uv venv","typeGuard":null,"tryCatchPattern":"try:\n    from vllm import collect_env\n    report = collect_env.get_env()  # or CLI equivalent\nexcept RuntimeError as e:\n    if \"pip list\" in str(e):\n        report = \"package listing unavailable\"\n    else:\n        raise","preventionTips":["Keep pip installed in venvs used for diagnostics","Prefer uv-created venvs so the fallback branch works"],"tags":["diagnostics","environment","pip","uv","packaging"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}