{"record":{"id":"97e2f9a6665e3c6b","repo":"LykosAI/StabilityMatrix","slug":"comfyui-venv-was-not-found-at-venvdir-fullpath","errorCode":null,"errorMessage":"ComfyUI venv was not found at '{venvDir.FullPath}'.","messagePattern":"ComfyUI venv was not found at '(.+?)'\\.","errorType":"exception","errorClass":"DirectoryNotFoundException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Models/PackageModification/InstallWindowsRocmPackageCommandStep.cs","lineNumber":77,"sourceCode":"\n    public async Task ExecuteAsync(IProgress<ProgressReport>? progress = null)\n    {\n        if (!OperatingSystem.IsWindows())\n        {\n            throw new PlatformNotSupportedException(\n                \"Windows ROCm package commands are only supported on Windows.\"\n            );\n        }\n\n        if (InstalledPackage.FullPath is null)\n        {\n            throw new InvalidOperationException(\"Installed package path is not available.\");\n        }\n\n        var venvDir = WorkingDirectory.JoinDir(\"venv\");\n        if (!venvDir.Exists)\n        {\n            throw new DirectoryNotFoundException($\"ComfyUI venv was not found at '{venvDir.FullPath}'.\");\n        }\n\n        var pyVersion = PyVersion.Parse(InstalledPackage.PythonVersion);\n        if (pyVersion.StringValue == \"0.0.0\")\n        {\n            pyVersion = PyInstallationManager.Python_3_10_11;\n        }\n\n        var baseInstall = !string.IsNullOrWhiteSpace(InstalledPackage.PythonVersion)\n            ? new PyBaseInstall(\n                await pyInstallationManager.GetInstallationAsync(pyVersion).ConfigureAwait(false)\n            )\n            : PyBaseInstall.Default;\n\n        await using var venvRunner = baseInstall.CreateVenvRunner(\n            venvDir,\n            workingDirectory: WorkingDirectory,\n            environmentVariables: EnvironmentVariables","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Models/PackageModification/InstallWindowsRocmPackageCommandStep.cs#L59-L95","documentation":"The step looks for a virtual environment at '<WorkingDirectory>/venv' before running any pip installs for Windows ROCm components. If that directory does not exist it throws DirectoryNotFoundException. This means the target package (e.g. ComfyUI) was never fully installed or its venv was deleted/moved, so there is no Python environment to install into.","triggerScenarios":"Calling ExecuteAsync when WorkingDirectory/venv is absent: package install was interrupted, user deleted the venv folder, the package lives on a different drive than WorkingDirectory, or WorkingDirectory itself points at the wrong package root.","commonSituations":"Running ROCm SageAttention/FlashAttention installers after a failed ComfyUI install; antivirus quarantining venv contents; user cleaning disk space by deleting venv folders; pointing the step at an extracted package zip that was never set up.","solutions":["Reinstall or update the package so its venv is recreated (ComfyUI install creates venv/ under the package root).","Verify WorkingDirectory is the package's actual root directory containing the venv folder.","If the venv is on another drive, fix the package record path instead of re-running this step.","Pre-check with Directory.Exists(Path.Combine(workingDirectory, \"venv\")) before queuing the step."],"exampleFix":"// before\nawait rocmStep.ExecuteAsync(progress);\n// after\nvar venv = Path.Combine(workingDirectory, \"venv\");\nif (!Directory.Exists(venv))\n    throw new InvalidOperationException($\"Run the package install first; venv missing at {venv}\");\nawait rocmStep.ExecuteAsync(progress);","handlingStrategy":"validation","validationCode":"var venvDir = Path.Combine(workingDirectory, \"venv\");\nif (!Directory.Exists(venvDir))\n    throw new InvalidOperationException($\"Package venv missing at '{venvDir}'; install the package first.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    await step.ExecuteAsync(progress);\n}\ncatch (DirectoryNotFoundException)\n{\n    // venv missing: reinstall/update the package, then retry\n}","preventionTips":["Always complete the package install (venv creation) before running ROCm add-on steps.","Don't delete or move venv folders manually; use the app's package management.","Confirm WorkingDirectory is the package root, not a parent or subdirectory."],"tags":["directory-not-found","venv","python","rocm"],"backgroundTag":"directory-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"}