{"record":{"id":"62c29152522093d1","repo":"PyO3/pyo3","slug":"broken-python-interpreter","errorCode":null,"errorMessage":"broken Python interpreter: {}","messagePattern":"broken Python interpreter: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pyo3-build-config/src/impl_.rs","lineNumber":486,"sourceCode":"print(\"implementation\", platform.python_implementation())\nprint(\"version_major\", sys.version_info[0])\nprint(\"version_minor\", sys.version_info[1])\nprint(\"shared\", PYPY or GRAALPY or ANACONDA or WINDOWS or FRAMEWORK or SHARED)\nprint(\"python_framework_prefix\", FRAMEWORK_PREFIX)\nprint_if_set(\"ld_version\", get_config_var(\"LDVERSION\"))\nprint_if_set(\"libdir\", get_config_var(\"LIBDIR\"))\nprint_if_set(\"base_prefix\", base_prefix)\nprint(\"executable\", sys.executable)\nprint(\"calcsize_pointer\", struct.calcsize(\"P\"))\nprint(\"mingw\", get_platform().startswith(\"mingw\"))\nprint(\"cygwin\", get_platform().startswith(\"cygwin\"))\nprint(\"ext_suffix\", get_config_var(\"EXT_SUFFIX\"))\nprint(\"gil_disabled\", get_config_var(\"Py_GIL_DISABLED\"))\n\"#;\n        let output = run_python_script(interpreter.as_ref(), SCRIPT)?;\n        let map: HashMap<String, String> = parse_script_output(&output);\n\n        ensure!(\n            !map.is_empty(),\n            \"broken Python interpreter: {}\",\n            interpreter.as_ref().display()\n        );\n\n        if let Some(value) = map.get(\"graalpy_major\") {\n            let graalpy_version = PythonVersion {\n                major: value\n                    .parse()\n                    .context(\"failed to parse GraalPy major version\")?,\n                minor: map[\"graalpy_minor\"]\n                    .parse()\n                    .context(\"failed to parse GraalPy minor version\")?,\n            };\n            ensure!(\n                graalpy_version >= MINIMUM_SUPPORTED_VERSION_GRAALPY,\n                \"At least GraalPy version {} needed, got {}\",\n                MINIMUM_SUPPORTED_VERSION_GRAALPY,","sourceCodeStart":468,"sourceCodeEnd":504,"githubUrl":"https://github.com/PyO3/pyo3/blob/ac9b6899d348be4d54614d060dea53a645a12e36/pyo3-build-config/src/impl_.rs#L468-L504","documentation":"InterpreterConfig::from_interpreter runs a probe script against the Python interpreter and parses its key/value output. If the interpreter produces no parseable output at all (empty map), pyo3 concludes the interpreter is broken rather than trusting an empty configuration, and fails the build with this message naming the interpreter path.","triggerScenarios":"run_python_script succeeds with exit 0 but stdout is empty or unparseable (parse_script_output yields an empty HashMap), so ensure!(!map.is_empty()) fires — typically an interpreter that 'succeeds' but ignores stdin or produces no stdout.","commonSituations":"Windows Store python.exe stub that prints a store-advertisement and exits 0; wrapper scripts swallowing stdin; interpreters that hang/succeed without evaluating piped scripts; Aliased python shim (e.g. conda, pyenv shims) misbehaving.","solutions":["Test the interpreter directly: `<path> -c \"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))\"` and confirm real output","Replace shim/stub interpreters (Windows Store alias, broken pyenv/conda shim) with a real Python executable via PYO3_PYTHON","Reinstall the Python distribution if it silently ignores piped scripts","Check that the 'interpreter' is actually Python and not a shell alias or App Execution Alias"],"exampleFix":"// shell, before\nexport PYO3_PYTHON=/c/Users/me/AppData/Local/Microsoft/WindowsApps/python3.exe  # Store stub\n// after\nexport PYO3_PYTHON=C:/Python312/python.exe","handlingStrategy":"validation","validationCode":"// shell\nOUT=$(${PYO3_PYTHON:-python3} -c 'import sysconfig; print(\"ext_suffix\", sysconfig.get_config_var(\"EXT_SUFFIX\"))'); [ -n \"$OUT\" ] || echo 'empty output: interpreter is a stub/shim — replace it'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Disable Windows Store App Execution Aliases for python.exe","Resolve pyenv/conda shims to the real binary for PYO3_PYTHON","Confirm the interpreter echoes output from piped stdin, not just -c"],"tags":["rust","pyo3","python-interpreter","broken-interpreter","windows","build-time"],"backgroundTag":"broken-python-interpreter","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"}