Install & Compatibility
Where this runs
tested against v4.4.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.282s · 129.1MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.9s · import 0.246s · 105MB
115MB installed
● package 115MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
cmake
✓ from cmake import cmake
✗ import cmake
cpack
✓ from cmake import cpack
ctest
✓ from cmake import ctest
This quickstart demonstrates how to retrieve the path to the CMake executable provided by the `cmake` package and execute a basic CMake command using Python's `subprocess` module. It also shows how to get the version string directly from the `cmake` package.
import cmake
import subprocess
import sys
try:
cmake_executable = cmake.cmake_path()
print(f"Found CMake executable at: {cmake_executable}")
# Run a simple CMake command, e.g., --version
result = subprocess.run([cmake_executable, '--version'], capture_output=True, text=True, check=True)
print("\nCMake --version output:")
print(result.stdout)
# Example of getting CMake version programmatically
print(f"\nCMake version from package: {cmake.cmake_version()}")
except subprocess.CalledProcessError as e:
print(f"Error running CMake: {e}", file=sys.stderr)
print(f"Stderr: {e.stderr}", file=sys.stderr)
except Exception as e:
print(f"An unexpected error occurred: {e}", file=sys.stderr)
cmake --version
Debug
Known issues
breakingPython 3.7 and older `manylinux` wheels were dropped in CMake Python distribution version 4.1.0. If you require Python 3.7 or older `manylinux` environments (e.g., `manylinux2010`, `manylinux1`), you must use an older version of the `cmake` package (e.g., 4.0.3 for Python 3.7/manylinux2010, 3.22.x for manylinux1).fixUpgrade your Python version to 3.8+ or pin the `cmake` package version to `~=4.0.3` for Python 3.7, or `~=3.22` for older manylinux.
affects: >=4.1.0
gotchaThe `cmake` Python package primarily serves to provide a convenient, platform-specific distribution of the CMake *executable*. It does not offer a high-level Python API for interacting with CMake's build system features directly within Python. For building Python extension modules using CMake, consider higher-level build backends like `scikit-build` or `scikit-build-core` which utilize this `cmake` package.fixUse `subprocess` to execute CMake commands via `cmake.cmake_path()`. If building Python C/C++/Fortran extensions with CMake, use `scikit-build` or `scikit-build-core` as your build backend.
affects: All
deprecatedOlder CMake modules `FindPythonInterp` and `FindPythonLibs` are deprecated and are no-ops since CMake 3.27. Using them in `CMakeLists.txt` will not correctly find Python installations with modern CMake versions.fixMigrate your `CMakeLists.txt` files to use the modern `find_package(Python3 COMPONENTS Interpreter Development)` command.
affects: All versions of CMake provided by this package (4.x)
breakingCMake 3.28 (and subsequent versions distributed by this package) changed the `PATH` behavior for Windows, where `find_{library,path,file}()` no longer searches the system `PATH` by default. This might break existing projects that rely on `PATH` for finding libraries on Windows.fixExplicitly add necessary directories to `CMAKE_PREFIX_PATH` or `CMAKE_LIBRARY_PATH` in your `CMakeLists.txt` or via command-line options when configuring CMake.
affects: >=3.28
breakingCMake 3.5 compatibility was removed. Calls to `cmake_minimum_required()` or `cmake_policy()` setting policy versions below 3.5 will now result in an error.fixUpdate your `CMakeLists.txt` to specify `cmake_minimum_required(VERSION X.Y)` with `X.Y` being at least 3.5, or preferably a more recent version (e.g., 3.15+ for improved `FindPython` modules).
affects: >=4.0
Upgrade
Version history
4.4.2latest on PyPI · released Aug 4, 2026
Audit
Dependencies
No dependency data recorded yet.