LykosAI/StabilityMatrix · error · DirectoryNotFoundException

ComfyUI venv was not found at

Error message

ComfyUI venv was not found at '{venvDir.FullPath}'.

What it means

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.

Solutions

  1. Reinstall or update the package so its venv is recreated (ComfyUI install creates venv/ under the package root).
  2. Verify WorkingDirectory is the package's actual root directory containing the venv folder.
  3. If the venv is on another drive, fix the package record path instead of re-running this step.
  4. Pre-check with Directory.Exists(Path.Combine(workingDirectory, "venv")) before queuing the step.

Example fix

// before
await rocmStep.ExecuteAsync(progress);
// after
var venv = Path.Combine(workingDirectory, "venv");
if (!Directory.Exists(venv))
    throw new InvalidOperationException($"Run the package install first; venv missing at {venv}");
await rocmStep.ExecuteAsync(progress);
Defensive patterns

Strategy: validation

Validate before calling

var venvDir = Path.Combine(workingDirectory, "venv");
if (!Directory.Exists(venvDir))
    throw new InvalidOperationException($"Package venv missing at '{venvDir}'; install the package first.");

Try / catch

try
{
    await step.ExecuteAsync(progress);
}
catch (DirectoryNotFoundException)
{
    // venv missing: reinstall/update the package, then retry
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12). Data as JSON: /api/errors/97e2f9a6665e3c6b. Report an issue: GitHub.

Appendix: source

Thrown at StabilityMatrix.Core/Models/PackageModification/InstallWindowsRocmPackageCommandStep.cs:77

    public async Task ExecuteAsync(IProgress<ProgressReport>? progress = null)
    {
        if (!OperatingSystem.IsWindows())
        {
            throw new PlatformNotSupportedException(
                "Windows ROCm package commands are only supported on Windows."
            );
        }

        if (InstalledPackage.FullPath is null)
        {
            throw new InvalidOperationException("Installed package path is not available.");
        }

        var venvDir = WorkingDirectory.JoinDir("venv");
        if (!venvDir.Exists)
        {
            throw new DirectoryNotFoundException($"ComfyUI venv was not found at '{venvDir.FullPath}'.");
        }

        var pyVersion = PyVersion.Parse(InstalledPackage.PythonVersion);
        if (pyVersion.StringValue == "0.0.0")
        {
            pyVersion = PyInstallationManager.Python_3_10_11;
        }

        var baseInstall = !string.IsNullOrWhiteSpace(InstalledPackage.PythonVersion)
            ? new PyBaseInstall(
                await pyInstallationManager.GetInstallationAsync(pyVersion).ConfigureAwait(false)
            )
            : PyBaseInstall.Default;

        await using var venvRunner = baseInstall.CreateVenvRunner(
            venvDir,
            workingDirectory: WorkingDirectory,
            environmentVariables: EnvironmentVariables

View on GitHub (pinned to af93d6ef57)