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
PipShow runs `pip show <package>` inside the venv and throws ProcessException when pip exits non-zero. It means pip itself failed to query the package (not merely that the package is missing). The message includes stdout and stderr so the caller can see pip's own diagnostic.
Solutions
- Check the stderr in the message: if it says 'Package(s) not found', call PipInstall for the package first or treat it as absent.
- Run `pip show <package>` manually with the venv python (e.g. `venv/bin/python -m pip show <pkg>`) to reproduce.
- Verify pip is intact: `venv/bin/python -m pip --version`; reinstall pip via `python -m ensurepip --upgrade` if broken.
- Confirm the correct venv (BaseInstall.RootPath) is being targeted — a wrong venv lacks the package.
Example fix
// before
var info = venv.PipShow("torch");
// after
var info = venv.PipShow("torch"); // wrap in try-catch or pre-check:
// if (await venv.PipInstallResult(new PipInstallParams { Packages = ["torch"] })) { ... } Defensive patterns
Strategy: try-catch
Validate before calling
if (!File.Exists(venv.PipPath)) throw new InvalidOperationException("venv pip missing");
var installed = await venv.PipList(); // pre-check membership instead of relying on PipShow Type guard
bool HasPip(PyVenvRunner v) => File.Exists(v.PipPath);
Try / catch
try { var result = venv.PipShow(pkg); ... }
catch (ProcessException ex) when (ex.Message.Contains("not found")) { /* treat package as absent */ } Prevention
- Pre-check package membership with PipList before PipShow
- Wrap pip helpers in a resilient wrapper returning null on failure
- Keep the venv's pip healthy and up to date
When it happens
Trigger: Calling PyVenvRunner.PipShow(packageName) when the pip subprocess returns a non-zero exit code — e.g. package not found (exit 1), broken venv, corrupted pip metadata.
Common situations: Querying a package that is not installed in the venv; the venv's pip is broken or was deleted; site-packages was partially removed; package name misspelled.
Related errors
- pip show returned no output for package
- install script failed with code
- get-pip not found
- pip not found
- Venv creation failed with code
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/ea9ab3f96374de6a.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Python/PyVenvRunner.cs:377
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)