{"record":{"id":"b3e135a30781385d","repo":"LykosAI/StabilityMatrix","slug":"no-compatible-torch-version-found-in-the-virtual-environment","errorCode":null,"errorMessage":"No compatible torch version found in the virtual environment.","messagePattern":"No compatible torch version found in the virtual environment\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Models/PackageModification/InstallNunchakuStep.cs","lineNumber":69,"sourceCode":"            11 => \"cp311\",\n            12 => \"cp312\",\n            13 => \"cp313\",\n            _ => throw new ArgumentOutOfRangeException(\"Invalid Python version\"),\n        };\n        var platform = Compat.IsWindows ? \"win_amd64\" : \"linux_x86_64\";\n\n        if (torchInfo is null)\n        {\n            throw new InvalidOperationException(\"Torch is not installed in the virtual environment.\");\n        }\n\n        var torchVersion = torchInfo.Version switch\n        {\n            var v when v.StartsWith(\"2.7\") => \"2.7\",\n            var v when v.StartsWith(\"2.8\") => \"2.8\",\n            var v when v.StartsWith(\"2.9\") => \"2.9\",\n            var v when v.StartsWith(\"2.10\") => \"2.10\",\n            _ => throw new InvalidOperationException(\n                \"No compatible torch version found in the virtual environment.\"\n            ),\n        };\n\n        var downloadUrl =\n            $\"https://github.com/nunchaku-tech/nunchaku/releases/download/v1.0.2/nunchaku-1.0.2+torch{torchVersion}-{shortPythonVersionString}-{shortPythonVersionString}-{platform}.whl\";\n        progress?.Report(\n            new ProgressReport(-1f, message: \"Installing Nunchaku backend\", isIndeterminate: true)\n        );\n\n        await venvRunner.PipInstall(downloadUrl, progress.AsProcessOutputHandler()).ConfigureAwait(false);\n\n        progress?.Report(\n            new ProgressReport(1f, message: \"Nunchaku backend installed successfully\", isIndeterminate: false)\n        );\n\n        var extensions = await ComfyExtensionManager\n            .GetManifestExtensionsAsync(ComfyExtensionManager.DefaultManifests)","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Models/PackageModification/InstallNunchakuStep.cs#L51-L87","documentation":"InstallNunchakuStep maps the installed torch version (2.7–2.10) to a Nunchaku wheel tag; any other torch version hits the switch default and throws InvalidOperationException, since no prebuilt Nunchaku wheel exists for it.","triggerScenarios":"Running the Nunchaku install step with a venv containing torch < 2.7, > 2.10, or a dev/rc version not starting with those prefixes.","commonSituations":"Very new torch releases ahead of Nunchaku wheel publishing; old pinned torch from legacy packages; nightly torch builds.","solutions":["Upgrade or downgrade torch in the venv to a supported release (2.7, 2.8, 2.9, or 2.10)","Wait for/update to a Stability Matrix version supporting newer Nunchaku wheels","Build Nunchaku from source against your torch version instead of using this install step"],"exampleFix":"// before\nvenv.PipInstall(\"torch\"); // may install unsupported version\n// after\nvenv.PipInstall(\"torch==2.8.0\");","handlingStrategy":"validation","validationCode":"var torch = await venv.GetPipPackageInfo(\"torch\");\nvar supported = new[]{\"2.7\",\"2.8\",\"2.9\",\"2.10\"};\nif (torch is null || !supported.Any(p => torch.Version.StartsWith(p))) pinTorch(venv);","typeGuard":null,"tryCatchPattern":"try { await step.ExecuteAsync(progress); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"compatible torch\")) { /* pin torch to 2.7-2.10 and retry */ }","preventionTips":["Pin torch to a Nunchaku-supported release (2.7–2.10)","Check Nunchaku release notes for newly supported torch versions","Avoid nightly/rc torch builds in package venvs"],"tags":["csharp","python","torch","version-compatibility"],"backgroundTag":"version-incompatible","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"}