{"record":{"id":"dad70c108fbaa134","repo":"LykosAI/StabilityMatrix","slug":"default-python-installation-not-found-at-defaultinstallation","errorCode":null,"errorMessage":"Default Python installation not found at {defaultInstallation.InstallPath}","messagePattern":"Default Python installation not found at (.+?)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Python/PyRunner.cs","lineNumber":237,"sourceCode":"    }\n\n    /// <summary>$\n    /// Initializes the Python runtime using the embedded dll.\n    /// Can be called with no effect after initialization.\n    /// </summary>\n    /// <exception cref=\"FileNotFoundException\">Thrown if Python DLL not found.</exception>\n    public async Task Initialize()\n    {\n        if (PythonEngine.IsInitialized)\n            return;\n\n        // Get the default installation\n        var defaultInstallation = await installationManager\n            .GetDefaultInstallationAsync()\n            .ConfigureAwait(false);\n        if (!defaultInstallation.Exists())\n        {\n            throw new FileNotFoundException(\n                $\"Default Python installation not found at {defaultInstallation.InstallPath}\"\n            );\n        }\n\n        currentInstallation = defaultInstallation;\n        await InitializeWithInstallation(defaultInstallation).ConfigureAwait(false);\n    }\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","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Python/PyRunner.cs#L219-L255","documentation":"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.","triggerScenarios":"Calling PyRunner.Initialize() when no default Python installation exists or its folder was deleted/moved after registration.","commonSituations":"First-run before any Python runtime was downloaded, user manually deleted the shared runtime folder, reset app data partially, failed upgrade left stale registration.","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"],"exampleFix":"// before\nawait pyRunner.Initialize(); // no runtime installed\n// after\nawait installationManager.SetupSharedRuntimeAsync(defaultVersion);\nawait pyRunner.Initialize();","handlingStrategy":"validation","validationCode":"var defaultInstallation = await installationManager.GetDefaultInstallationAsync();\nif (!Directory.Exists(defaultInstallation.InstallPath))\n    await installationManager.SetupSharedRuntimeAsync();","typeGuard":null,"tryCatchPattern":"try\n{\n    await pyRunner.Initialize();\n}\ncatch (FileNotFoundException ex)\n{\n    logger.LogError(ex, \"Default Python install missing; setting up runtime\");\n    await installationManager.SetupSharedRuntimeAsync();\n    await pyRunner.Initialize();\n}","preventionTips":["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"],"tags":["python","environment","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"}