PyO3/pyo3 · error

cannot set a minimum Python version {} higher than the inter

Error message

cannot set a minimum Python version {} higher than the interpreter version {} (the minimum Python version is implied by the {}-py3{} feature)

What it means

Consistency error in PythonAbi::from_stable_abi: the caller-supplied minimum Python version (implied by the chosen py3x cargo feature, e.g. the '8' in pyo3/py38) is greater than the detected interpreter version. A crate declaring a higher minimum than the interpreter it is being built against cannot be satisfied.

Source

Thrown at pyo3-build-config/src/impl_.rs:1043

}

impl PythonAbi {
    /// Constructs the ABI to target for an interpreter of `version`, given the
    /// stable ABI kind and minimum Python version to target, if any.
    ///
    /// Callers decide whether a stable ABI applies to the interpreter; this
    /// does not consult the `abi3`/`abi3t` cargo features. The minimum version
    /// must not exceed the interpreter version. Without a stable ABI the
    /// result is version-specific, free-threaded when `gil_disabled` is set.
    pub fn from_stable_abi(
        implementation: PythonImplementation,
        version: PythonVersion,
        stable_abi: Option<(StableAbi, PythonVersion)>,
        gil_disabled: bool,
    ) -> Result<PythonAbi> {
        let builder = match stable_abi {
            Some((kind, min_version)) => {
                ensure!(
                    min_version <= version,
                    "cannot set a minimum Python version {} higher than the interpreter version {} \
                     (the minimum Python version is implied by the {}-py3{} feature)",
                    min_version,
                    version,
                    kind,
                    min_version.minor
                );
                PythonAbiBuilder::new(implementation, min_version).stable_abi(kind)
            }
            None if gil_disabled => PythonAbiBuilder::new(implementation, version).free_threaded(),
            None => PythonAbiBuilder::new(implementation, version),
        };
        builder.finalize()
    }

    /// Constructs the ABI to target for an interpreter of `version` from the
    /// enabled cargo features.

View on GitHub (pinned to ac9b6899d3)

Solutions

  1. Lower the minimum-version cargo feature (e.g. py38 instead of py312) so it does not exceed the interpreter
  2. Upgrade the target Python interpreter to at least the declared minimum
  3. Check PYO3_CROSS_PYTHON_VERSION for a stale or wrong value pinning an older interpreter
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pyo3-build-config/src/impl_.rs:1043 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of PyO3/pyo3@ac9b6899d3 (2026-09-05). Data as JSON: /api/errors/13b1cab7a60f0a20. Report an issue: GitHub.