{"record":{"id":"fa4c09f1e8ec656f","repo":"LykosAI/StabilityMatrix","slug":"pip-install-failed-with-code-process-exitcode-output-fa4c09","errorCode":null,"errorMessage":"pip install failed with code {Process.ExitCode}: {output.ToString().ToRepr()}","messagePattern":"pip install failed with code (.+?): (.+?)","errorType":"exception","errorClass":"ProcessException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Python/UvVenvRunner.cs","lineNumber":261,"sourceCode":"        {\n            Logger.Debug($\"Pip output: {s.Text}\");\n            // Record to output\n            output.Append(s.Text);\n            // Forward to callback\n            outputDataReceived?.Invoke(s);\n        });\n\n        RunUvDetached(\n            args.Prepend([\"pip\", \"install\"])\n                .Concat([\"--index-strategy\", \"unsafe-first-match\", \"--python\", PythonPath.ToString()]),\n            outputAction\n        );\n        await Process.WaitForExitAsync().ConfigureAwait(false);\n\n        // Check return code\n        if (Process.ExitCode != 0)\n        {\n            throw new ProcessException(\n                $\"pip install failed with code {Process.ExitCode}: {output.ToString().ToRepr()}\"\n            );\n        }\n    }\n\n    /// <summary>\n    /// Run a pip uninstall command. Waits for the process to exit.\n    /// workingDirectory defaults to RootPath.\n    /// </summary>\n    public async Task PipUninstall(ProcessArgs args, Action<ProcessOutput>? outputDataReceived = null)\n    {\n        if (!File.Exists(UvExecutablePath))\n        {\n            throw new FileNotFoundException(\"uv not found\", UvExecutablePath);\n        }\n\n        SetPyvenvCfg(BaseInstall.RootPath);\n","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Python/UvVenvRunner.cs#L243-L279","documentation":"PipInstall() runs `uv pip install ... --python <venv python>` and captures all process output. If uv exits non-zero it throws ProcessException including the exit code and the accumulated output (via ToRepr). This mirrors pip's failure semantics for resolution, download, and build errors.","triggerScenarios":"uv pip install exits non-zero: package/version not found on any index, dependency resolution conflict, network failure reaching the index, build backend failure for sdist packages, or incompatible wheel for the platform/Python version.","commonSituations":"Pinning a version that doesn't exist or lacks a wheel for the OS; private index unreachable; --index-strategy unsafe-first-match pulling a bad source; transient network outage; torch/CUDA packages requiring a special index URL.","solutions":["Read the captured output in the exception message to find the exact uv failure (resolver, network, or build)","Verify the package name and version spec exist for the venv's Python version and platform","Check network/proxy access to the package index; add needed --index-url/--extra-index-url args","Retry on transient network errors; use Prepend of index options for packages needing custom indexes"],"exampleFix":"// before\nawait venv.PipInstall(new ProcessArgs(\"torch==9.9.9\"));\n// after\ntry\n{\n    await venv.PipInstall(new ProcessArgs(\"torch==2.1.0\"));\n}\ncatch (ProcessException e)\n{\n    logger.LogError(e, \"uv pip install failed\"); // inspect e.Message for uv output\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    await venv.PipInstall(args);\n}\ncatch (ProcessException e)\n{\n    logger.LogError(e, \"uv pip install failed: {Output}\", e.Message);\n    // e.Message contains exit code and full captured uv output for diagnosis\n}","preventionTips":["Pin package versions known to have wheels for the target platform/Python","Attach outputDataReceived to stream install progress and capture errors live","Check network/index reachability before large installs","Retry with backoff on transient network failures"],"tags":["python","pip","uv","package-install","process"],"backgroundTag":"command-not-found","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}