{"record":{"id":"43b0750167451373","repo":"PyO3/pyo3","slug":"neither-abi3-or-abi3t-features-are-enabled","errorCode":null,"errorMessage":"Neither abi3 or abi3t features are enabled","messagePattern":"Neither abi3 or abi3t features are enabled","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pyo3-build-config/src/impl_.rs","lineNumber":2323,"sourceCode":"}\n\n/// Generates \"default\" interpreter configuration when compiling stable ABI extensions\n/// without a working Python interpreter.\n///\n/// `abi3_version` or `abi3t_version` specifies the minimum supported Stable ABI\n/// CPython version and which stable ABI to target.\n///\n/// This should work for most CPython extension modules when compiling on\n/// Windows, macOS and Linux.\n///\n/// Must be called from a PyO3 crate build script.\nfn default_stable_abi_config(\n    host: &Triple,\n    abi3_version: Option<PythonVersion>,\n    abi3t_version: Option<PythonVersion>,\n) -> Result<InterpreterConfig> {\n    if abi3_version.is_none() && abi3t_version.is_none() {\n        bail!(\"Neither abi3 or abi3t features are enabled\")\n    }\n    let (stable_abi, version) = if let Some(version) = abi3_version {\n        (StableAbi::Abi3, version)\n    } else if let Some(version) = abi3t_version {\n        (StableAbi::Abi3t, version)\n    } else {\n        unreachable!();\n    };\n\n    if stable_abi == StableAbi::Abi3t && version < MINIMUM_SUPPORTED_VERSION_ABI3T {\n        bail!(\"Cannot target an abi3t version below {MINIMUM_SUPPORTED_VERSION_ABI3T}\")\n    }\n\n    // FIXME: PyPy & GraalPy do not support the Stable ABI.\n    let target_abi = PythonAbiBuilder::new(PythonImplementation::CPython, version)\n        .stable_abi(stable_abi)\n        .finalize()?;\n    let builder = InterpreterConfigBuilder::new(PythonImplementation::CPython, version)","sourceCodeStart":2305,"sourceCodeEnd":2341,"githubUrl":"https://github.com/PyO3/pyo3/blob/ac9b6899d348be4d54614d060dea53a645a12e36/pyo3-build-config/src/impl_.rs#L2305-L2341","documentation":"pyo3's build config requires one of the `abi3` or `abi3t` (free-threaded stable ABI) cargo features to be enabled when a stable-ABI configuration is being derived. `default_stable_abi_config` is only reached when the build expects a stable ABI target, and finding neither feature enabled means the stable ABI request is inconsistent with the declared features, so the build fails immediately with this message.","triggerScenarios":"Enabling stable-ABI-related configuration (e.g. PYO3_USE_ABI3_FORWARD_COMPATIBILITY paths, cross-compilation config files, or pyo3-build-config internals that call default_stable_abi_config) without enabling the `abi3` or `abi3t` cargo feature on the pyo3 dependency.","commonSituations":"Developers toggle `features = [\"abi3\"]` off while leaving other abi3 settings in place; Cargo feature resolution strips `abi3` because another crate in the graph disabled it; hand-written build scripts or config-generation code call into pyo3-build-config expecting a stable ABI but never declare the feature.","solutions":["Add `abi3` (or `abi3t` for free-threaded Python) to the pyo3 feature list in Cargo.toml","If you do not want the stable ABI, remove whatever invokes the abi3 configuration path (e.g. abi3-pyXY features or PYO3 abi3-related env settings)","Run `cargo tree -e features` to confirm the abi3 feature actually reaches pyo3, since features are unified across the dependency graph"],"exampleFix":"// before\npyo3 = { version = \"0.22\", features = [\"extension-module\"] }\n// after\npyo3 = { version = \"0.22\", features = [\"extension-module\", \"abi3-py38\"] }","handlingStrategy":"validation","validationCode":"# Cargo.toml check before building\n// shell\n cargo tree -e features | grep -q 'pyo3 .*abi3' || echo 'abi3 feature missing: add features = [\"abi3\"] to pyo3'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always declare abi3 via a versioned feature like abi3-py38 rather than hand-rolled config","Run cargo tree -e features in CI to assert the abi3 feature reaches pyo3","Do not selectively strip features from pyo3 in workspace member manifests"],"tags":["rust","pyo3","cargo-features","abi3","build-time"],"backgroundTag":"missing-cargo-feature","analyzedSha":"ac9b6899d348be4d54614d060dea53a645a12e36","analyzedAt":"2026-09-05T09:20:35.319Z","contentChangedAt":"2026-09-05T09:20:35.319Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}