LykosAI/StabilityMatrix · error · FileNotFoundException
Default Python installation not found at
Error message
Default Python installation not found at {defaultInstallation.InstallPath} What it means
PyRunner.Initialize (parameterless) resolves the default Python installation from the installation manager and validates it exists on disk before initializing the engine. If the default installation directory is missing, a FileNotFoundException naming the InstallPath is thrown.
Solutions
- Ensure a Python runtime is installed via the installation manager (download shared runtime) before calling Initialize
- Verify defaultInstallation.InstallPath exists; reinstall if missing
- Catch FileNotFoundException and run environment setup/repair flow
- Re-register a valid default installation
Example fix
// before await pyRunner.Initialize(); // no runtime installed // after await installationManager.SetupSharedRuntimeAsync(defaultVersion); await pyRunner.Initialize();
Defensive patterns
Strategy: validation
Validate before calling
var defaultInstallation = await installationManager.GetDefaultInstallationAsync();
if (!Directory.Exists(defaultInstallation.InstallPath))
await installationManager.SetupSharedRuntimeAsync(); Try / catch
try
{
await pyRunner.Initialize();
}
catch (FileNotFoundException ex)
{
logger.LogError(ex, "Default Python install missing; setting up runtime");
await installationManager.SetupSharedRuntimeAsync();
await pyRunner.Initialize();
} Prevention
- Ensure first-run setup downloads the shared runtime before Python features are used
- Check default installation existence at app startup
- Repair/reinstall the runtime after partial data-directory deletes
When it happens
Trigger: Calling PyRunner.Initialize() when no default Python installation exists or its folder was deleted/moved after registration.
Common situations: First-run before any Python runtime was downloaded, user manually deleted the shared runtime folder, reset app data partially, failed upgrade left stale registration.
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
- Python installation not found at
- Python linked library not found
- get-pip not found
- pip not found
- pyvenv.cfg not found
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/dad70c108fbaa134.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Python/PyRunner.cs:237
}
/// <summary>$
/// Initializes the Python runtime using the embedded dll.
/// Can be called with no effect after initialization.
/// </summary>
/// <exception cref="FileNotFoundException">Thrown if Python DLL not found.</exception>
public async Task Initialize()
{
if (PythonEngine.IsInitialized)
return;
// Get the default installation
var defaultInstallation = await installationManager
.GetDefaultInstallationAsync()
.ConfigureAwait(false);
if (!defaultInstallation.Exists())
{
throw new FileNotFoundException(
$"Default Python installation not found at {defaultInstallation.InstallPath}"
);
}
currentInstallation = defaultInstallation;
await InitializeWithInstallation(defaultInstallation).ConfigureAwait(false);
}
/// <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)
: currentInstallationView on GitHub (pinned to af93d6ef57)