LykosAI/StabilityMatrix · error · FileNotFoundException
get-pip not found
Error message
get-pip not found
What it means
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.
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
Example fix
// before
await pyRunner.SetupPip(); // get-pip.pyc missing
// after
if (!File.Exists(Path.Combine(install.InstallPath, "get-pip.pyc")))
await installationManager.ReinstallSharedRuntimeAsync(install.Version);
await pyRunner.SetupPip(); Defensive patterns
Strategy: validation
Validate before calling
var getPipPath = Path.Combine(installation.InstallPath, "get-pip.pyc");
if (!File.Exists(getPipPath))
await installationManager.ReinstallSharedRuntimeAsync(installation.Version); Try / catch
try
{
await pyRunner.SetupPip();
}
catch (FileNotFoundException ex)
{
logger.LogError(ex, "get-pip missing; recreating environment");
await installationManager.ReinstallSharedRuntimeAsync();
await pyRunner.SetupPip();
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- pip not found
- pip not found
- pip not found
- Python installation not found at
- Python linked library not found
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/3f3463863adb1e94.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Python/PyRunner.cs:262
}
/// <summary>
/// One-time setup for get-pip
/// </summary>
public async Task SetupPip(PyVersion? version = null)
{
// Use either the specified version or the current installation
var installation =
version != null
? await installationManager.GetInstallationAsync(version.Value).ConfigureAwait(false)
: currentInstallation
?? await installationManager.GetDefaultInstallationAsync().ConfigureAwait(false);
var getPipPath = Path.Combine(installation.InstallPath, "get-pip.pyc");
if (!File.Exists(getPipPath))
{
throw new FileNotFoundException("get-pip not found", getPipPath);
}
await ProcessRunner
.GetProcessResultAsync(installation.PythonExePath, ["-m", "get-pip"])
.EnsureSuccessExitCode()
.ConfigureAwait(false);
// Pip version 24.1 deprecated numpy star requirement spec used by some packages
// So make the base pip less than that for compatibility, venvs can upgrade themselves if needed
await ProcessRunner
.GetProcessResultAsync(
installation.PythonExePath,
["-m", "pip", "install", "pip==23.3.2", "setuptools==69.5.1"]
)
.EnsureSuccessExitCode()
.ConfigureAwait(false);
}
View on GitHub (pinned to af93d6ef57)