LykosAI/StabilityMatrix · error · ProcessException
pip install failed with code
Error message
pip install failed with code {Process.ExitCode}: {output.ToString().ToRepr()} What it means
PipInstall() runs `-m pip install --exists-action s` and throws ProcessException when the pip process exits non-zero. The exception message includes the exit code and captured output (via ToRepr) to surface pip's own error (resolution conflict, network failure, missing package, etc.).
Solutions
- Read the captured output in the exception message to find pip's specific failure line.
- Check network/proxy access to the package index; configure PipIndex if using a mirror.
- Relax or correct the pinned versions in the requirements causing resolution failures.
- Re-run pip install manually inside the venv to reproduce and iterate on the error.
Example fix
// before
await venvRunner.PipInstall("torch==99.0");
// after
try
{
await venvRunner.PipInstall("torch>=2.0");
}
catch (ProcessException e)
{
Logger.Error("pip install failed: {Msg}", e.Message);
throw;
} Defensive patterns
Strategy: try-catch
Try / catch
try
{
await venvRunner.PipInstall(args, onOutput);
}
catch (ProcessException e)
{
Logger.Error("pip install failed: {Msg}", e.Message); // message carries pip output
throw;
} Prevention
- Pin requirements that exist for the target platform/Python version.
- Configure PipIndex for mirrors/private indexes and verify network/proxy access.
- Capture streamed output so failures are diagnosable.
- Ensure build tools are present for packages without wheels.
When it happens
Trigger: Any pip install failure: package/version not found on the index, dependency resolution conflict, network/proxy failure, missing compiler for an sdist build, or disk full — anything making `pip install` return non-zero.
Common situations: Version specifier not available for the platform/Python version; private index not configured (PipIndex); corporate proxy blocking PyPI; build tools missing on Windows for packages without wheels; stale hash/requirements pinning.
Related errors
- pip install failed with code
- pip list failed with code
- pip show failed with code
- pip show returned no output for package
- get-pip not found
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/38a401e0f84237a3.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Python/PyVenvRunner.cs:249
// 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);
});
RunDetached(args.Prepend("-m pip install").Concat("--exists-action s"), outputAction);
await Process.WaitForExitAsync().ConfigureAwait(false);
// Check return code
if (Process.ExitCode != 0)
{
throw new ProcessException(
$"pip install failed with code {Process.ExitCode}: {output.ToString().ToRepr()}"
);
}
}
/// <summary>
/// Run a pip uninstall command. Waits for the process to exit.
/// workingDirectory defaults to RootPath.
/// </summary>
public async Task PipUninstall(ProcessArgs args, Action<ProcessOutput>? outputDataReceived = null)
{
if (!File.Exists(PipPath))
{
throw new FileNotFoundException("pip not found", PipPath);
}
// Record output for errors
var output = new StringBuilder();View on GitHub (pinned to af93d6ef57)