{"record":{"id":"3f3463863adb1e94","repo":"LykosAI/StabilityMatrix","slug":"get-pip-not-found","errorCode":null,"errorMessage":"get-pip not found","messagePattern":"get-pip not found","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Python/PyRunner.cs","lineNumber":262,"sourceCode":"    }\n\n    /// <summary>\n    /// One-time setup for get-pip\n    /// </summary>\n    public async Task SetupPip(PyVersion? version = null)\n    {\n        // Use either the specified version or the current installation\n        var installation =\n            version != null\n                ? await installationManager.GetInstallationAsync(version.Value).ConfigureAwait(false)\n                : currentInstallation\n                    ?? await installationManager.GetDefaultInstallationAsync().ConfigureAwait(false);\n\n        var getPipPath = Path.Combine(installation.InstallPath, \"get-pip.pyc\");\n\n        if (!File.Exists(getPipPath))\n        {\n            throw new FileNotFoundException(\"get-pip not found\", getPipPath);\n        }\n\n        await ProcessRunner\n            .GetProcessResultAsync(installation.PythonExePath, [\"-m\", \"get-pip\"])\n            .EnsureSuccessExitCode()\n            .ConfigureAwait(false);\n\n        // Pip version 24.1 deprecated numpy star requirement spec used by some packages\n        // So make the base pip less than that for compatibility, venvs can upgrade themselves if needed\n        await ProcessRunner\n            .GetProcessResultAsync(\n                installation.PythonExePath,\n                [\"-m\", \"pip\", \"install\", \"pip==23.3.2\", \"setuptools==69.5.1\"]\n            )\n            .EnsureSuccessExitCode()\n            .ConfigureAwait(false);\n    }\n","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Python/PyRunner.cs#L244-L280","documentation":"PyRunner.SetupPip bootstraps pip by running get-pip inside the target installation. It expects 'get-pip.pyc' inside the installation's InstallPath; if absent, a FileNotFoundException with the path is thrown.","triggerScenarios":"Calling SetupPip on an installation whose folder lacks get-pip.pyc — e.g. a custom or freshly-created install that never bundled the get-pip script, or the file was deleted.","commonSituations":"Manually constructed installations missing bundled bootstrap files, interrupted provisioning that copied only the interpreter, cleaning up '.pyc' files as junk and removing get-pip.pyc.","solutions":["Restore/re-provision the installation so get-pip.pyc exists in InstallPath","Copy a current get-pip bootstrap file into the installation directory","Use 'python -m ensurepip' instead if pip bootstrapping via bundled script is unavailable","Catch FileNotFoundException and recreate the environment from scratch"],"exampleFix":"// before\nawait pyRunner.SetupPip(); // get-pip.pyc missing\n// after\nif (!File.Exists(Path.Combine(install.InstallPath, \"get-pip.pyc\")))\n    await installationManager.ReinstallSharedRuntimeAsync(install.Version);\nawait pyRunner.SetupPip();","handlingStrategy":"validation","validationCode":"var getPipPath = Path.Combine(installation.InstallPath, \"get-pip.pyc\");\nif (!File.Exists(getPipPath))\n    await installationManager.ReinstallSharedRuntimeAsync(installation.Version);","typeGuard":null,"tryCatchPattern":"try\n{\n    await pyRunner.SetupPip();\n}\ncatch (FileNotFoundException ex)\n{\n    logger.LogError(ex, \"get-pip missing; recreating environment\");\n    await installationManager.ReinstallSharedRuntimeAsync();\n    await pyRunner.SetupPip();\n}","preventionTips":["Never delete .pyc bootstrap files from install directories","Ensure provisioning completes fully before enabling pip features","Fall back to 'python -m ensurepip' when the bundled script is absent"],"tags":["python","pip","file-not-found"],"backgroundTag":"file-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"}