{"record":{"id":"9630783baf7c6ceb","repo":"astral-sh/ruff","slug":"uv-is-not-installed-or-not-found-in-path-if-you-n","errorCode":null,"errorMessage":"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/","messagePattern":"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/","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ruff_benchmark/src/real_world_projects.rs","lineNumber":274,"sourceCode":"///\n/// Creates a venv under `target/benchmark_cache/<name>/.venv` and installs the given\n/// dependencies using `uv pip install` with `--exclude-newer` for reproducibility. The venv is\n/// reused across benchmark runs. Returns the path to the venv directory.\npub fn install_dependencies_to_cache(\n    name: &str,\n    dependencies: &[&str],\n    venv_path: &PathBuf,\n    python_version: SupportedPythonVersion,\n    max_dep_date: &str,\n) -> Result<()> {\n    // Check if uv is available\n    let uv_check = Command::new(\"uv\")\n        .arg(\"--version\")\n        .output()\n        .context(\"Failed to execute uv version check.\")?;\n\n    if !uv_check.status.success() {\n        anyhow::bail!(\n            \"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/\"\n        );\n    }\n\n    let python_version_str = python_version.to_string();\n\n    let output = Command::new(\"uv\")\n        .args([\"venv\", \"--python\", &python_version_str, \"--allow-existing\"])\n        .arg(venv_path)\n        .output()\n        .context(\"Failed to execute uv venv command\")?;\n\n    anyhow::ensure!(\n        output.status.success(),\n        \"Failed to create virtual environment: {}\",\n        String::from_utf8_lossy(&output.stderr)\n    );\n","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ruff_benchmark/src/real_world_projects.rs#L256-L292","documentation":"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.","triggerScenarios":"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.","commonSituations":"A broken package-manager install of uv; another tool named uv earlier in PATH; Windows shims that fail without a console.","solutions":["Run `uv --version` yourself — it must print a version cleanly","Install or reinstall uv following https://docs.astral.sh/uv/getting-started/installation/","Find and remove the shadowing binary: `which -a uv` (or `where uv` on Windows)"],"exampleFix":"# before\n cargo bench fails: uv is not installed or not found in PATH ...\n\n# after\ncurl -LsSf https://astral.sh/uv/install.sh | sh && cargo bench --bench <real-world-bench>","handlingStrategy":"validation","validationCode":"command -v uv >/dev/null && uv --version >/dev/null || {\n  echo \"install uv first: https://docs.astral.sh/uv/getting-started/installation/\" >&2\n  exit 1\n}\ncargo bench --bench \"$bench\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bootstrap uv in CI before running real-world benchmarks (curl ... | sh or pip install uv)","Pin a known-good uv version in the CI image","Run `which -a uv` when the spawn succeeds but --version fails — a shadowing binary is the usual cause"],"tags":["benchmark","dependencies","tooling"],"backgroundTag":null,"analyzedSha":"672bb4edf04c84f8b0753346359daee4057158f2","analyzedAt":"2026-08-16T08:54:05.464Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}