{"record":{"id":"296faf6d35443cac","repo":"perspective-dev/perspective","slug":"expected-python-to-be-set-in-conda-build-environme","errorCode":null,"errorMessage":"Expected PYTHON to be set in CONDA_BUILD environment, but it isn't.  maturin will likely detect the wrong Python.","messagePattern":"Expected PYTHON to be set in CONDA_BUILD environment, but it isn't\\.  maturin will likely detect the wrong Python\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/perspective-python/build.mjs","lineNumber":91,"sourceCode":"    target = \"--target=aarch64-apple-darwin\";\n} else if (process.env.PSP_ARCH === \"x86_64\" && process.platform === \"linux\") {\n    target = \"--target=x86_64-unknown-linux-gnu --compatibility manylinux_2_28\";\n} else if (process.env.PSP_ARCH === \"aarch64\" && process.platform === \"linux\") {\n    target = \"--target=aarch64-unknown-linux-gnu\";\n}\n\nif (build_wheel) {\n    if (!!process.env.PSP_BUILD_VERBOSE) {\n        flags += \" -vv\";\n    }\n\n    if (process.env.CONDA_BUILD === \"1\") {\n        console.log(\"Building with Conda flags and features\");\n        if (process.env.PYTHON) {\n            console.log(`interpreter: ${process.env.PYTHON}`);\n            flags += ` --interpreter=${process.env.PYTHON}`;\n        } else {\n            console.warn(\n                \"Expected PYTHON to be set in CONDA_BUILD environment, but it isn't.  maturin will likely detect the wrong Python.\",\n            );\n        }\n        // we need to generate proto.rs using conda's protoc, which is set in\n        // the environment.  we use the unstable \"versioned\" python abi\n        features.push([\"generate-proto\"]);\n    } else {\n        // standard for in-repo builds.  a different set will be standard in the sdist\n        const standard_features = [\"abi3\", \"generate-proto\", \"protobuf-src\"];\n\n        console.log(\"Building with standard flags and features\");\n        features.push(...standard_features);\n    }\n\n    execSync(\n        `${emsdk_prefix}maturin build ${flags} --features=${features.join(\",\")} ${target}`,\n        { stdio: \"inherit\", env },\n    );","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/perspective-dev/perspective/blob/11c8238c0c9c0b9e490b5a6a2dc277afad1e980a/rust/perspective-python/build.mjs#L73-L109","documentation":"Build-time warning in the perspective-python conda build path: CONDA_BUILD=1 was detected but the PYTHON environment variable is unset, so maturin cannot be pointed at the conda-managed interpreter and may build against the wrong Python installation, producing an ABI-mismatched wheel.","triggerScenarios":"Thrown at rust/perspective-python/build.mjs:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the PYTHON env var to the conda build's python executable path before invoking the build","Verify the conda recipe exports PYTHON (standard conda-build behavior) and that it isn't stripped in the build script","Check conda-build version; older versions handle PYTHON differently","Review the maturin invocation flags to confirm which interpreter gets targeted"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"11c8238c0c9c0b9e490b5a6a2dc277afad1e980a","analyzedAt":"2026-09-09T00:35:19.377Z","contentChangedAt":"2026-09-09T00:35:19.377Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}