vllm-project/vllm · error · ValueError
Could not determine Python executable. Please provide it man
Error message
Could not determine Python executable. Please provide it manually.
What it means
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.
Source
Thrown at tools/generate_cmake_presets.py:68
"path to nvcc (e.g., /usr/local/cuda/bin/nvcc): "
)
nvcc_path = nvcc_path_input.strip()
print(f"Using NVCC path: {nvcc_path}")
# Detect Python executable
python_executable = get_python_executable()
if python_executable:
print(f"Found Python via sys.executable: {python_executable}")
else:
python_executable_prompt = (
"Could not automatically find Python executable. Please provide "
"the full path to your Python executable for vLLM development "
"(typically from your virtual environment, e.g., "
"/home/user/venvs/vllm/bin/python): "
)
python_executable = input(python_executable_prompt).strip()
if not python_executable:
raise ValueError(
"Could not determine Python executable. Please provide it manually."
)
print(f"Using Python executable: {python_executable}")
# Get CPU cores
cpu_cores = get_cpu_cores()
nvcc_threads = min(4, cpu_cores)
cmake_jobs = max(1, cpu_cores // nvcc_threads)
print(
f"Detected {cpu_cores} CPU cores. "
f"Setting NVCC_THREADS={nvcc_threads} and CMake jobs={cmake_jobs}."
)
# Get vLLM project root (assuming this script is in vllm/tools/)
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
print(f"VLLM project root detected as: {project_root}")
View on GitHub (pinned to c794754062)
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.
Example fix
# before python tools/generate_cmake_presets.py < /dev/null # -> ValueError: Could not determine Python executable. # after source .venv/bin/activate && .venv/bin/python tools/generate_cmake_presets.py
Defensive patterns
Strategy: validation
Validate before calling
import sys
if not sys.executable:
raise SystemExit("Run via an interpreter with a populated sys.executable (e.g. .venv/bin/python)") Prevention
- 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.
When it happens
Trigger: Running generate_cmake_presets.py non-interactively (CI, piped stdin) where sys.executable is empty and the prompt receives EOF/empty input.
Common situations: Scripting CMake preset generation in CI with stdin closed; invoking the tool through an embedded interpreter that reports an empty sys.executable.
Related errors
- Interactive input is unavailable. Pass --model and --hardwar
- failed to parse `RUST_LOG`
- Cannot find CMake executable
- CUDA is required for this proof.
- Failed to find the NIXL wheel after building it.
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/a22ca57ebcb43836.
Report an issue: GitHub.