perspective-dev/perspective · error
Expected PYTHON to be set in CONDA_BUILD environment, but…
Error message
Expected PYTHON to be set in CONDA_BUILD environment, but it isn't. maturin will likely detect the wrong Python.
What it means
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.
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at rust/perspective-python/build.mjs:91 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of perspective-dev/perspective@11c8238c0c (2026-09-09).
Data as JSON: /api/errors/296faf6d35443cac.
Report an issue: GitHub.
Appendix: source
Thrown at rust/perspective-python/build.mjs:91
target = "--target=aarch64-apple-darwin";
} else if (process.env.PSP_ARCH === "x86_64" && process.platform === "linux") {
target = "--target=x86_64-unknown-linux-gnu --compatibility manylinux_2_28";
} else if (process.env.PSP_ARCH === "aarch64" && process.platform === "linux") {
target = "--target=aarch64-unknown-linux-gnu";
}
if (build_wheel) {
if (!!process.env.PSP_BUILD_VERBOSE) {
flags += " -vv";
}
if (process.env.CONDA_BUILD === "1") {
console.log("Building with Conda flags and features");
if (process.env.PYTHON) {
console.log(`interpreter: ${process.env.PYTHON}`);
flags += ` --interpreter=${process.env.PYTHON}`;
} else {
console.warn(
"Expected PYTHON to be set in CONDA_BUILD environment, but it isn't. maturin will likely detect the wrong Python.",
);
}
// we need to generate proto.rs using conda's protoc, which is set in
// the environment. we use the unstable "versioned" python abi
features.push(["generate-proto"]);
} else {
// standard for in-repo builds. a different set will be standard in the sdist
const standard_features = ["abi3", "generate-proto", "protobuf-src"];
console.log("Building with standard flags and features");
features.push(...standard_features);
}
execSync(
`${emsdk_prefix}maturin build ${flags} --features=${features.join(",")} ${target}`,
{ stdio: "inherit", env },
);View on GitHub (pinned to 11c8238c0c)