LykosAI/StabilityMatrix · error · FileNotFoundException

uv not found

Error message

uv not found

What it means

PipInstall() delegates to the uv binary expected at <GlobalConfig.LibraryDir>/Assets/uv/uv(.exe). If that file does not exist it throws FileNotFoundException before running the command. uv is a bundled asset that the app must download/extract beforehand.

Solutions

  1. Ensure the uv asset is downloaded/extracted to LibraryDir/Assets/uv before calling PipInstall
  2. Check File.Exists on the uv path (respecting Compat.IsWindows) and trigger asset re-download if missing
  3. Reinstall/repair the application library assets
  4. Check antivirus quarantine for uv.exe and add an exclusion

Example fix

// before
await venv.PipInstall(new ProcessArgs("requests"));
// after
var uvPath = Path.Combine(GlobalConfig.LibraryDir, "Assets", "uv", Compat.IsWindows ? "uv.exe" : "uv");
if (!File.Exists(uvPath))
{
    await assetDownloader.DownloadUvAsync(ct);
}
await venv.PipInstall(new ProcessArgs("requests"));
Defensive patterns

Strategy: validation

Validate before calling

var uvPath = Path.Combine(GlobalConfig.LibraryDir, "Assets", "uv", Compat.IsWindows ? "uv.exe" : "uv");
if (!File.Exists(uvPath))
{
    await assetManager.EnsureUvDownloadedAsync(cancellationToken);
}

Try / catch

try
{
    await venv.PipInstall(args);
}
catch (FileNotFoundException e) when (e.FileName?.Contains("uv") == true)
{
    await assetManager.EnsureUvDownloadedAsync(ct);
    await venv.PipInstall(args); // retry once
}

Prevention

When it happens

Trigger: Calling PipInstall before the uv asset has been downloaded to LibraryDir/Assets/uv, or after the asset was deleted/corrupted, or on a platform where the expected uv.exe/uv filename is missing.

Common situations: Fresh install where asset download failed or was skipped; antivirus quarantining uv.exe; user manually cleaned the library Assets folder; portable install moved without Assets.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12). Data as JSON: /api/errors/6fcdb340cf6de49c. Report an issue: GitHub.

Appendix: source

Thrown at StabilityMatrix.Core/Python/UvVenvRunner.cs:234

        cfg["home"] = pythonDirectory;
        cfg["base-prefix"] = pythonDirectory;
        cfg["base-exec-prefix"] = pythonDirectory;
        cfg["base-executable"] = baseExecutable;
        cfg.Save(cfgPath);

        // Update last set path
        lastSetPyvenvCfgPath = pythonDirectory;
    }

    /// <summary>
    /// Run a pip install command. Waits for the process to exit.
    /// workingDirectory defaults to RootPath.
    /// </summary>
    public async Task PipInstall(ProcessArgs args, Action<ProcessOutput>? outputDataReceived = null)
    {
        if (!File.Exists(UvExecutablePath))
        {
            throw new FileNotFoundException("uv not found", UvExecutablePath);
        }

        SetPyvenvCfg(BaseInstall.RootPath);

        // Record output for errors
        var output = new StringBuilder();

        var outputAction = new Action<ProcessOutput>(s =>
        {
            Logger.Debug($"Pip output: {s.Text}");
            // Record to output
            output.Append(s.Text);
            // Forward to callback
            outputDataReceived?.Invoke(s);
        });

        RunUvDetached(
            args.Prepend(["pip", "install"])

View on GitHub (pinned to af93d6ef57)