LykosAI/StabilityMatrix · error · ProcessException

pip index failed with code

Error message

pip index failed with code {result.ExitCode}: {result.StandardOutput}, {result.StandardError}

What it means

UvVenvRunner.PipIndex runs `python -m pip index versions <pkg>` and throws this ProcessException when the process exits non-zero and the output does not contain the handled "No matching distribution found" marker (or an empty stdout, both of which return null instead). It surfaces pip's own stdout/stderr so the caller can see the real failure — typically a network/index problem rather than a missing package.

Solutions

  1. Inspect the StandardOutput/StandardError in the message to identify pip's actual complaint.
  2. Verify network connectivity to the index URL and correct any URL/auth mistakes in the indexUrl argument.
  3. Test `python -m pip index versions <pkg> --index-url <url>` manually in the same venv.
  4. Fix proxy/SSL configuration (set HTTPS_PROXY, trusted-host, or corporate certs) and retry.

Example fix

// before: treating every PipIndex failure as 'package not available'
var versions = await runner.PipIndex(pkg, indexUrl);
// after: distinguish null (no versions) from a pip/network failure
PipIndexResult? versions;
try { versions = await runner.PipIndex(pkg, indexUrl); }
catch (ProcessException ex) {
    Logger.Error($"pip index failed (network/index?): {ex.Message}");
    throw;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// probe index reachability before PipIndex
using var http = new HttpClient();
var ok = (await http.GetAsync(indexUrl ?? "https://pypi.org/simple/")).IsSuccessStatusCode;

Try / catch

try { versions = await runner.PipIndex(pkg, indexUrl); }
catch (ProcessException ex) { /* network/index issue; inspect ex.Message */ retry.WithBackoff(); }

Prevention

When it happens

Trigger: Calling PipIndex(packageName, indexUrl, includePrerelease) where pip exits non-zero for reasons other than no-matching-distribution: unreachable or misconfigured --index-url (bad URL, auth required), SSL/proxy failures, or pip itself failing to start inside the venv.

Common situations: Custom index URL typo or expired credentials; corporate proxy blocking PyPI; self-signed certificate failures; network outage; index URL pointing at a non-PEP-503 endpoint.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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

Appendix: source

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

        var noMatchingDistribution =
            result.StandardOutput?.Contains(
                "No matching distribution found",
                StringComparison.OrdinalIgnoreCase
            ) == true
            || result.StandardError?.Contains(
                "No matching distribution found",
                StringComparison.OrdinalIgnoreCase
            ) == true;

        if (noMatchingDistribution || string.IsNullOrWhiteSpace(result.StandardOutput))
        {
            return null;
        }

        // Check return code
        if (result.ExitCode != 0)
        {
            throw new ProcessException(
                $"pip index failed with code {result.ExitCode}: {result.StandardOutput}, {result.StandardError}"
            );
        }

        return PipIndexResult.Parse(result.StandardOutput);
    }

    /// <summary>
    /// Run a custom install command. Waits for the process to exit.
    /// workingDirectory defaults to RootPath.
    /// </summary>
    public async Task CustomInstall(ProcessArgs args, Action<ProcessOutput>? outputDataReceived = null)
    {
        // Record output for errors
        var output = new StringBuilder();

        var outputAction =
            outputDataReceived == null

View on GitHub (pinned to af93d6ef57)