astral-sh/ruff · error

uv is not installed or not found in PATH. If you need to ins

Error message

uv is not installed or not found in PATH. If you need to install it, follow the instructions at https://docs.astral.sh/uv/getting-started/installation/

What it means

Before building benchmark venvs, the harness runs `uv --version` and raises this message when uv executes but exits nonzero (broken or shadowed install). If the uv binary is missing entirely you instead get 'Failed to execute uv version check.' from the context on Command::output.

Source

Thrown at crates/ruff_benchmark/src/real_world_projects.rs:274

///
/// Creates a venv under `target/benchmark_cache/<name>/.venv` and installs the given
/// dependencies using `uv pip install` with `--exclude-newer` for reproducibility. The venv is
/// reused across benchmark runs. Returns the path to the venv directory.
pub fn install_dependencies_to_cache(
    name: &str,
    dependencies: &[&str],
    venv_path: &PathBuf,
    python_version: SupportedPythonVersion,
    max_dep_date: &str,
) -> Result<()> {
    // Check if uv is available
    let uv_check = Command::new("uv")
        .arg("--version")
        .output()
        .context("Failed to execute uv version check.")?;

    if !uv_check.status.success() {
        anyhow::bail!(
            "uv is not installed or not found in PATH. If you need to install it, follow the instructions at https://docs.astral.sh/uv/getting-started/installation/"
        );
    }

    let python_version_str = python_version.to_string();

    let output = Command::new("uv")
        .args(["venv", "--python", &python_version_str, "--allow-existing"])
        .arg(venv_path)
        .output()
        .context("Failed to execute uv venv command")?;

    anyhow::ensure!(
        output.status.success(),
        "Failed to create virtual environment: {}",
        String::from_utf8_lossy(&output.stderr)
    );

View on GitHub (pinned to 672bb4edf0)

Solutions

  1. Run `uv --version` yourself — it must print a version cleanly
  2. Install or reinstall uv following https://docs.astral.sh/uv/getting-started/installation/
  3. Find and remove the shadowing binary: `which -a uv` (or `where uv` on Windows)

Example fix

# before
 cargo bench fails: uv is not installed or not found in PATH ...

# after
curl -LsSf https://astral.sh/uv/install.sh | sh && cargo bench --bench <real-world-bench>
Defensive patterns

Strategy: validation

Validate before calling

command -v uv >/dev/null && uv --version >/dev/null || {
  echo "install uv first: https://docs.astral.sh/uv/getting-started/installation/" >&2
  exit 1
}
cargo bench --bench "$bench"

Prevention

When it happens

Trigger: Running real-world benchmarks on a machine where a same-named but broken `uv` is first on PATH, or an existing uv install is corrupted; a truly absent uv produces the different spawn error.

Common situations: A broken package-manager install of uv; another tool named uv earlier in PATH; Windows shims that fail without a console.

Related errors


AI-assisted analysis of astral-sh/ruff@672bb4edf0 (2026-08-16). Data as JSON: /api/errors/9630783baf7c6ceb. Report an issue: GitHub.