LykosAI/StabilityMatrix · error · ProcessException
pip show failed with code
Error message
pip show failed with code {result.ExitCode}: {result.StandardOutput}, {result.StandardError} What it means
UvVenvRunner.PipShow runs `uv pip show <package>` against the venv and throws this ProcessException when the process exits with a non-zero code and the output does not contain the handled "Package(s) not found" marker. It wraps the pip/uv subprocess failure (including its stdout and stderr) so callers get the underlying pip diagnostics instead of a raw exit code. It means the query itself failed — e.g. uv could not talk to the environment — not merely that the package is absent.
Solutions
- Read the StandardOutput/StandardError embedded in the message to identify the underlying pip/uv failure and fix that cause.
- Verify the venv is intact: check that PythonPath exists and `uv pip show` runs manually against the same interpreter.
- Recreate the venv (e.g. UvVenvRunner.SetupUvVenv / delete and re-setup) if the interpreter or site-packages are broken.
- Confirm the uv executable version matches expectations (File.Exists(UvExecutablePath) passed, but the binary may be stale) and update it.
Example fix
// before: assuming null means 'not installed' for every failure
var info = await runner.PipShow(packageName);
// after: catch and distinguish 'not installed' (null) from a real pip failure
PipShowResult? info;
try { info = await runner.PipShow(packageName); }
catch (ProcessException ex) {
Logger.Error($"pip show failed for {packageName}: {ex.Message}");
throw; // not-found is returned as null by PipShow; this is a genuine failure
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!File.Exists(runner.UvExecutablePath)) throw new InvalidOperationException("uv missing");
if (!File.Exists(runner.PythonPath)) throw new InvalidOperationException("venv python missing"); Type guard
static bool VenvUsable(UvVenvRunner r) => File.Exists(r.UvExecutablePath) && File.Exists(r.PythonPath);
Try / catch
try { var info = await runner.PipShow(pkg); }
catch (ProcessException ex) { Logger.Error(ex.Message); throw; } // null already means 'not installed' Prevention
- Remember PipShow returns null for not-found; only exceptions are real failures.
- Validate venv health (python + uv exist) before batch querying packages.
- Keep uv updated to a version with stable `pip show` behavior.
When it happens
Trigger: Calling UvVenvRunner.PipShow(packageName) where `uv pip show --python <venvPython>` exits non-zero for a reason other than "Package(s) not found": a corrupt or missing venv python, an invalid/unreachable --index/--python configuration, or uv crashing before producing a show result.
Common situations: The venv's python interpreter was deleted or upgraded out from under the venv; the uv executable is a mismatched version; environment variables or a custom index passed to the runner break the command; disk/permission problems inside the venv cause pip internals to fail.
Related errors
- Venv creation failed with code
- pip install failed with code
- pip list failed with code
- Venv creation failed with code
- pip install failed with code
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/7becda0ac4afadfd.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Python/UvVenvRunner.cs:394
EnvironmentVariables
)
.ConfigureAwait(false);
var packageNotFound =
result.StandardOutput?.Contains("Package(s) not found", StringComparison.OrdinalIgnoreCase)
== true
|| result.StandardError?.Contains("Package(s) not found", StringComparison.OrdinalIgnoreCase)
== true;
if (packageNotFound)
{
return null;
}
// Check return code
if (result.ExitCode != 0)
{
throw new ProcessException(
$"pip show failed with code {result.ExitCode}: {result.StandardOutput}, {result.StandardError}"
);
}
if (string.IsNullOrWhiteSpace(result.StandardOutput))
{
throw new ProcessException(
$"pip show returned no output for package '{packageName}': {result.StandardError}"
);
}
return PipShowResult.Parse(result.StandardOutput);
}
/// <summary>
/// Run a pip index command, return result as PipIndexResult.
/// </summary>
public async Task<PipIndexResult?> PipIndex(View on GitHub (pinned to af93d6ef57)