{"record":{"id":"a22ca57ebcb43836","repo":"vllm-project/vllm","slug":"could-not-determine-python-executable-please-prov","errorCode":null,"errorMessage":"Could not determine Python executable. Please provide it manually.","messagePattern":"Could not determine Python executable\\. Please provide it manually\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/generate_cmake_presets.py","lineNumber":68,"sourceCode":"            \"path to nvcc (e.g., /usr/local/cuda/bin/nvcc): \"\n        )\n        nvcc_path = nvcc_path_input.strip()\n    print(f\"Using NVCC path: {nvcc_path}\")\n\n    # Detect Python executable\n    python_executable = get_python_executable()\n    if python_executable:\n        print(f\"Found Python via sys.executable: {python_executable}\")\n    else:\n        python_executable_prompt = (\n            \"Could not automatically find Python executable. Please provide \"\n            \"the full path to your Python executable for vLLM development \"\n            \"(typically from your virtual environment, e.g., \"\n            \"/home/user/venvs/vllm/bin/python): \"\n        )\n        python_executable = input(python_executable_prompt).strip()\n        if not python_executable:\n            raise ValueError(\n                \"Could not determine Python executable. Please provide it manually.\"\n            )\n\n    print(f\"Using Python executable: {python_executable}\")\n\n    # Get CPU cores\n    cpu_cores = get_cpu_cores()\n    nvcc_threads = min(4, cpu_cores)\n    cmake_jobs = max(1, cpu_cores // nvcc_threads)\n    print(\n        f\"Detected {cpu_cores} CPU cores. \"\n        f\"Setting NVCC_THREADS={nvcc_threads} and CMake jobs={cmake_jobs}.\"\n    )\n\n    # Get vLLM project root (assuming this script is in vllm/tools/)\n    project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), \"..\"))\n    print(f\"VLLM project root detected as: {project_root}\")\n","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/tools/generate_cmake_presets.py#L50-L86","documentation":"tools/generate_cmake_presets.py needs a Python interpreter path to embed in CMakePresets.json. It first tries sys.executable; if that is empty (can happen under embedded/restricted launchers) it prompts interactively. When stdin yields an empty answer, this ValueError aborts generation.","triggerScenarios":"Running generate_cmake_presets.py non-interactively (CI, piped stdin) where sys.executable is empty and the prompt receives EOF/empty input.","commonSituations":"Scripting CMake preset generation in CI with stdin closed; invoking the tool through an embedded interpreter that reports an empty sys.executable.","solutions":["Invoke the script with your venv interpreter directly so sys.executable is populated: `/path/to/vllm-venv/bin/python tools/generate_cmake_presets.py`.","Run it in an interactive terminal and paste the full venv python path (e.g. /home/user/venvs/vllm/bin/python) when prompted.","Ensure the virtual environment is activated before running the tool."],"exampleFix":"# before\npython tools/generate_cmake_presets.py < /dev/null\n# -> ValueError: Could not determine Python executable.\n\n# after\nsource .venv/bin/activate && .venv/bin/python tools/generate_cmake_presets.py","handlingStrategy":"validation","validationCode":"import sys\nif not sys.executable:\n    raise SystemExit(\"Run via an interpreter with a populated sys.executable (e.g. .venv/bin/python)\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Invoke the script with the venv's python binary directly rather than through wrappers.","Never run generate_cmake_presets.py with stdin closed unless sys.executable is populated.","Activate the venv before any CMake preset generation step."],"tags":["tooling","cmake","environment","interactive-prompt"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}