{"record":{"id":"82d1ead274e51e35","repo":"PyO3/pyo3","slug":"could-not-find-sysconfigdata-py-in","errorCode":null,"errorMessage":"Could not find _sysconfigdata*.py in {}","messagePattern":"Could not find _sysconfigdata\\*\\.py in (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pyo3-build-config/src/impl_.rs","lineNumber":2047,"sourceCode":"\nfn starts_with(entry: &DirEntry, pat: &str) -> bool {\n    let name = entry.file_name();\n    name.to_string_lossy().starts_with(pat)\n}\nfn ends_with(entry: &DirEntry, pat: &str) -> bool {\n    let name = entry.file_name();\n    name.to_string_lossy().ends_with(pat)\n}\n\n/// Finds the sysconfigdata file when the target Python library directory is set.\n///\n/// Returns `None` if the library directory is not available, and a runtime error\n/// when no or multiple sysconfigdata files are found.\nfn find_sysconfigdata(cross: &CrossCompileConfig) -> Result<Option<PathBuf>> {\n    let mut sysconfig_paths = find_all_sysconfigdata(cross)?;\n    if sysconfig_paths.is_empty() {\n        if let Some(lib_dir) = cross.lib_dir.as_ref() {\n            bail!(\"Could not find _sysconfigdata*.py in {}\", lib_dir.display());\n        } else {\n            // Continue with the default configuration when PYO3_CROSS_LIB_DIR is not set.\n            return Ok(None);\n        }\n    } else if sysconfig_paths.len() > 1 {\n        let mut error_msg = String::from(\n            \"Detected multiple possible Python versions. Please set either the \\\n            PYO3_CROSS_PYTHON_VERSION variable to the wanted version or the \\\n            _PYTHON_SYSCONFIGDATA_NAME variable to the wanted sysconfigdata file name.\\n\\n\\\n            sysconfigdata files found:\",\n        );\n        for path in sysconfig_paths {\n            use std::fmt::Write;\n            write!(&mut error_msg, \"\\n\\t{}\", path.display()).unwrap();\n        }\n        bail!(\"{}\\n\", error_msg);\n    }\n","sourceCodeStart":2029,"sourceCodeEnd":2065,"githubUrl":"https://github.com/PyO3/pyo3/blob/ac9b6899d348be4d54614d060dea53a645a12e36/pyo3-build-config/src/impl_.rs#L2029-L2065","documentation":"Error from find_sysconfigdata during cross-compilation configuration: the PYO3_CROSS_LIB_DIR directory was searched but contained no file matching _sysconfigdata*.py, so the target interpreter's configuration cannot be read and cross-compile settings cannot be derived.","triggerScenarios":"Thrown at pyo3-build-config/src/impl_.rs:2047 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the cross lib dir contains the target interpreter's _sysconfigdata module (usually in its lib directory)","Point PYO3_CROSS_LIB_DIR at the correct sysroot/lib folder for the target","Alternatively set PYO3_CROSS_PYTHON_VERSION (and optionally PYO3_CROSS_PYTHON_IMPLEMENTATION) instead of supplying a lib dir"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}