scikit-build-core "CMake ... not found" Build Failure in CI
scikit-build-core drives a CMake build to compile a native Python extension. It needs cmake (and usually ninja) plus a C/C++ toolchain. A missing build tool, or a CMake error, aborts the wheel build.
What this error means
A pip install of a scikit-build-core project fails with Could not find CMake, ninja is required, or a CMake configure/compile error. There is no wheel for this platform, so pip ran the CMake build.
*** scikit-build-core 0.9 using CMake ...
CMake Error: CMake was not found on the PATH. Provide cmake or install it
(e.g. `pip install cmake ninja`).Common causes
CMake or ninja not installed
The runner lacks cmake/ninja. scikit-build-core can pull them from PyPI as build requires, but only if declared - otherwise the build cannot configure.
Missing C/C++ compiler or library
Even with CMake present, the configure step fails if the compiler or a required system library/header is absent.
How to fix it
Provide CMake and ninja via build requires
Let pip supply the build tools from PyPI in the isolated build env.
[build-system]
requires = ["scikit-build-core", "cmake>=3.15", "ninja"]
build-backend = "scikit_build_core.build"Install the toolchain on the runner
For system CMake plus a compiler and any needed dev libraries.
# Debian/Ubuntu
apt-get update && apt-get install -y build-essential cmake ninja-buildRead the CMake configure error
- Scroll to the first
CMake Error:line for the real cause (missing compiler, library, or header). - Install the named dev package, then re-run.
- Prefer a prebuilt wheel (
--only-binary) when one exists.
How to prevent it
- Declare
cmake/ninjain[build-system] requiresfor portability. - Bake the compiler and dev libraries into images that build from source.
- Prefer wheels in CI to skip the CMake build.