PyO3/pyo3 · error

At least GraalPy version {} needed, got {}

Error message

At least GraalPy version {} needed, got {}

What it means

When the configured interpreter is GraalPy, pyo3 requires at least MINIMUM_SUPPORTED_VERSION_GRAALPY because older GraalPy releases lack needed C-API compatibility. from_interpreter parses graalpy_major/graalpy_minor from the probe output and bails if the detected version is below the floor.

Source

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

        let output = run_python_script(interpreter.as_ref(), SCRIPT)?;
        let map: HashMap<String, String> = parse_script_output(&output);

        ensure!(
            !map.is_empty(),
            "broken Python interpreter: {}",
            interpreter.as_ref().display()
        );

        if let Some(value) = map.get("graalpy_major") {
            let graalpy_version = PythonVersion {
                major: value
                    .parse()
                    .context("failed to parse GraalPy major version")?,
                minor: map["graalpy_minor"]
                    .parse()
                    .context("failed to parse GraalPy minor version")?,
            };
            ensure!(
                graalpy_version >= MINIMUM_SUPPORTED_VERSION_GRAALPY,
                "At least GraalPy version {} needed, got {}",
                MINIMUM_SUPPORTED_VERSION_GRAALPY,
                graalpy_version
            );
        };

        let shared = map["shared"].as_str() == "True";
        let python_framework_prefix = map.get("python_framework_prefix").cloned();

        let version = PythonVersion {
            major: map["version_major"]
                .parse()
                .context("failed to parse major version")?,
            minor: map["version_minor"]
                .parse()
                .context("failed to parse minor version")?,
        };

View on GitHub (pinned to ac9b6899d3)

Solutions

  1. Upgrade GraalPy to at least MINIMUM_SUPPORTED_VERSION_GRAALPY (see pyo3 docs for the exact version for your pyo3 release)
  2. If you cannot upgrade, pin pyo3 to an older release that supports your GraalPy version
  3. Switch the build to a CPython interpreter if GraalPy support is not required

Example fix

# before
gu install graalpy && export PYO3_PYTHON=~/graalpy-23.0/bin/graalpy
# after
# download GraalPy >= 24.x (check pyo3 docs for the minimum)
export PYO3_PYTHON=~/graalpy-24.1/bin/graalpy && cargo build
Defensive patterns

Strategy: validation

Validate before calling

// shell
if ${PYO3_PYTHON:-graalpy} -c 'import sys; sys.exit(0 if sys.implementation.name=="graalpy" else 1)' 2>/dev/null; then ${PYO3_PYTHON} -c 'import sys; print("graalpy version", sys.version_info[:2])'; fi

Prevention

When it happens

Trigger: Building against a GraalPy interpreter whose detected (major, minor) version compares less than MINIMUM_SUPPORTED_VERSION_GRAALPY — e.g. pointing PYO3_PYTHON at an old GraalPy install or a GraalPy-based venv pinned to an old version.

Common situations: Projects with GraalPy pinned in their lockfile/CI to a release older than pyo3's supported minimum; stale GraalPy installations on dev machines; upgrading pyo3 raises the minimum, suddenly failing previously-working builds.

Related errors


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