PyO3/pyo3 · error

no interpreter executable

Error message

no interpreter executable

What it means

Panic in run_python_script: the code path needs to execute a Python script to probe the interpreter, but InterpreterConfig::executable is None — no interpreter path was recorded (typical when the config was built purely from sysconfigdata or a cached file). Probing is impossible, so the helper panics instead of returning a Result for this precondition.

Source

Thrown at pyo3-build-config/src/impl_.rs:883

        write_option_line!(pointer_width)?;
        write_line!(build_flags)?;
        write_option_line!(python_framework_prefix)?;
        write_line!(suppress_build_script_link_lines)?;
        for line in &self.extra_build_script_lines {
            writeln!(writer, "extra_build_script_line={line}")
                .context("failed to write extra_build_script_line")?;
        }
        Ok(())
    }

    /// Run a python script using the [`InterpreterConfig::executable`].
    ///
    /// # Panics
    ///
    /// This function will panic if the [`executable`](InterpreterConfig::executable) is `None`.
    pub fn run_python_script(&self, script: &str) -> Result<String> {
        run_python_script_with_envs(
            Path::new(self.executable.as_ref().expect("no interpreter executable")),
            script,
            std::iter::empty::<(&str, &str)>(),
        )
    }

    /// Run a python script using the [`InterpreterConfig::executable`] with additional
    /// environment variables (e.g. PYTHONPATH) set.
    ///
    /// # Panics
    ///
    /// This function will panic if the [`executable`](InterpreterConfig::executable) is `None`.
    pub fn run_python_script_with_envs<I, K, V>(&self, script: &str, envs: I) -> Result<String>
    where
        I: IntoIterator<Item = (K, V)>,
        K: AsRef<OsStr>,
        V: AsRef<OsStr>,
    {
        run_python_script_with_envs(

View on GitHub (pinned to ac9b6899d3)

Solutions

  1. Set PYO3_PYTHON (or ensure the interpreter can be auto-detected) so an executable is stored in the config
  2. When cross-compiling, provide complete sysconfigdata so no interpreter needs to be run
  3. Delete a stale pyo3-build-config-file that lacks the executable field so detection reruns
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pyo3-build-config/src/impl_.rs:883 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of PyO3/pyo3@ac9b6899d3 (2026-09-05). Data as JSON: /api/errors/4f9d54b092c5f045. Report an issue: GitHub.