{"record":{"id":"4725c84395d7a782","repo":"vllm-project/vllm","slug":"cannot-find-cmake-executable","errorCode":null,"errorMessage":"Cannot find CMake executable","messagePattern":"Cannot find CMake executable","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"setup.py","lineNumber":333,"sourceCode":"            cmake_args += [f\"-DCMAKE_CUDA_COMPILER={CUDA_HOME}/bin/nvcc\"]\n        elif _is_hip() and ROCM_HOME is not None:\n            cmake_args += [f\"-DROCM_PATH={ROCM_HOME}\"]\n\n        other_cmake_args = os.environ.get(\"CMAKE_ARGS\")\n        if other_cmake_args:\n            cmake_args += other_cmake_args.split()\n\n        subprocess.check_call(\n            [\"cmake\", ext.cmake_lists_dir, *build_tool, *cmake_args],\n            cwd=self.build_temp,\n        )\n\n    def build_extensions(self) -> None:\n        # Ensure that CMake is present and working\n        try:\n            subprocess.check_output([\"cmake\", \"--version\"])\n        except OSError as e:\n            raise RuntimeError(\"Cannot find CMake executable\") from e\n\n        # Create build directory if it does not exist.\n        if not os.path.exists(self.build_temp):\n            os.makedirs(self.build_temp)\n\n        targets = []\n\n        def target_name(s: str) -> str:\n            return s.removeprefix(\"vllm.\").removeprefix(\"vllm_flash_attn.\")\n\n        # Build all the extensions\n        for ext in self.extensions:\n            self.configure(ext)\n            targets.append(target_name(ext.name))\n\n        num_jobs, _ = self.compute_num_jobs()\n\n        build_args = [","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/setup.py#L315-L351","documentation":"Raised by setup.py's custom build_ext (line 333) when `subprocess.check_output([\"cmake\", \"--version\"])` fails with OSError — i.e. no `cmake` executable is resolvable on PATH. Building vLLM from source (C/C++/CUDA extensions) requires CMake at build time; the check fails fast before any compilation starts.","triggerScenarios":"Running `pip install -e .` or `python setup.py build_ext` without cmake installed, with cmake installed but not on PATH, or with a broken cmake binary (wrong architecture, missing shared libs).","commonSituations":"Fresh containers/CI images without build tooling; macOS/Windows where cmake is installed via an app not symlinked into PATH; nix/conda environments where the build subprocess does not inherit the shell's PATH.","solutions":["Install CMake >= 3.26: `pip install cmake` (fastest, puts it next to the build python) or use apt/brew","Verify `cmake --version` works in the same environment that runs the build","Alternatively avoid the local build: use a precompiled wheel (e.g. VLLM_USE_PRECOMPILED=1 or the precompiled-wheel flow)"],"exampleFix":"# before\n$ pip install -e .\nRuntimeError: Cannot find CMake executable\n\n# after\n$ pip install cmake\n$ cmake --version   # sanity check\n$ pip install -e .","handlingStrategy":"validation","validationCode":"import shutil, subprocess\nassert shutil.which(\"cmake\") is not None, \"cmake not on PATH; run: pip install cmake\"\nsubprocess.check_output([\"cmake\", \"--version\"])  # also catches a broken binary","typeGuard":null,"tryCatchPattern":"try:\n    subprocess.check_output([\"cmake\", \"--version\"])\nexcept OSError:\n    raise RuntimeError(\"Cannot find CMake executable — install with `pip install cmake`\") from None","preventionTips":["Add `cmake` to build-image requirements next to torch/cuda toolchains","In containers, install cmake inside the same environment/PATH the build runs from"],"tags":["python","build","cmake","setup","vllm"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}