{"record":{"id":"a038e0ff6a8a34c1","repo":"LykosAI/StabilityMatrix","slug":"windows-rocm-bitsandbytes-is-only-supported-on-python-3-12-x","errorCode":null,"errorMessage":"Windows ROCm bitsandbytes is only supported on Python 3.12.x (detected version: {pyVersion}).","messagePattern":"Windows ROCm bitsandbytes is only supported on Python 3\\.12\\.x \\(detected version: (.+?)\\)\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Models/PackageModification/InstallWindowsRocmPackageCommandStep.cs","lineNumber":213,"sourceCode":"                AttnQkInt8PerBlockCausalUrl,\n                progress\n            )\n            .ConfigureAwait(false);\n        await DownloadAndReplaceFileAsync(sageAttentionDir, \"quant_per_block.py\", QuantPerBlockUrl, progress)\n            .ConfigureAwait(false);\n    }\n\n    private async Task ExecuteBitsAndBytesAsync(\n        IPyVenvRunner venvRunner,\n        PyVersion pyVersion,\n        IProgress<ProgressReport>? progress\n    )\n    {\n        EnsureRocmCompatibility();\n\n        if (pyVersion.Major != 3 || pyVersion.Minor != 12)\n        {\n            throw new InvalidOperationException(\n                $\"Windows ROCm bitsandbytes is only supported on Python 3.12.x (detected version: {pyVersion}).\"\n            );\n        }\n\n        progress?.Report(\n            new ProgressReport(-1f, \"Installing bitsandbytes for Windows ROCm...\", isIndeterminate: true)\n        );\n        await venvRunner.PipInstall(BitsAndBytesWheelUrl).ConfigureAwait(false);\n    }\n\n    private async Task ExecuteFlashAttentionAsync(\n        IPyVenvRunner venvRunner,\n        IProgress<ProgressReport>? progress\n    )\n    {\n        EnsureRocmCompatibility();\n\n        progress?.Report(","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Models/PackageModification/InstallWindowsRocmPackageCommandStep.cs#L195-L231","documentation":"ExecuteBitsAndBytesAsync in InstallWindowsRocmPackageCommandStep enforces that the bitsandbytes wheels for Windows ROCm are built only against Python 3.12. Before downloading anything it calls EnsureRocmCompatibility() and then verifies the detected venv Python version is exactly 3.x with minor 12; otherwise it throws InvalidOperationException with the detected version embedded. This is a hard guard because the ROCm bitsandbytes wheels simply do not exist for other Python minor versions on Windows.","triggerScenarios":"Calling ExecuteAsync on an InstallWindowsRocmPackageCommandStep (the Windows ROCm package-modification step) whose target package venv runs a Python other than 3.12.x — e.g. a ComfyUI or SD package venv created with 3.10, 3.11, or 3.13 — reaches ExecuteBitsAndBytesAsync and hits the pyVersion.Major/Minor check.","commonSituations":"User installed a package with a default venv pinned to Python 3.10/3.11 (common for older Stability Matrix packages) and then runs the Windows ROCm AMD setup; user upgraded their Python or recreated the venv with a newer interpreter; the venv was rebuilt by a package update to 3.13 while the ROCm step still assumes 3.12 wheels.","solutions":["Recreate the package venv with Python 3.12 ( Stability Matrix: delete/rename the venv folder and let the package reinstall, or pick a Python 3.12 download in package preferences), then rerun the ROCm install step.","Check the detected version in the exception message against `python --version` inside the package's venv and align the interpreter to 3.12.x.","If 3.12 is impossible, install bitsandbytes ROCm manually via pip with a wheel matching your Python, bypassing this step.","Report/request support for your Python version if upstream publishes matching ROCm wheels later."],"exampleFix":"// before: venv built with 3.11, step throws\nvar pyVersion = await venvRunner.GetPythonVersionAsync();\n// venvRunner: Python 3.11.9  -> InvalidOperationException\n\n// after: recreate venv with Python 3.12\nvar pyVersion = await venvRunner.GetPythonVersionAsync();\n// venvRunner: Python 3.12.4  -> check passes, bitsandbytes installs","handlingStrategy":"validation","validationCode":"var pyVersion = await venvRunner.GetPythonVersionAsync(ct);\nif (pyVersion.Major != 3 || pyVersion.Minor != 12)\n    throw new InvalidOperationException(\n        $\"Windows ROCm bitsandbytes requires Python 3.12.x; venv has {pyVersion}. Recreate the venv with Python 3.12 before running the ROCm step.\");","typeGuard":"bool IsPython312(Version v) => v.Major == 3 && v.Minor == 12;","tryCatchPattern":"try\n{\n    await step.ExecuteAsync(progress, ct);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Python 3.12\"))\n{\n    logger.LogWarning(ex, \"ROCm bitsandbytes step skipped: venv Python not 3.12.x\");\n    // surface guidance: recreate venv with Python 3.12\n}","preventionTips":["Pin package venvs to Python 3.12 wherever Windows ROCm (AMD) support is intended.","Check the venv interpreter version before offering/running the ROCm modification step in the UI.","Log the detected Python version in install diagnostics so mismatches are visible immediately."],"tags":["python","rocm","amd","venv","version-check","windows"],"backgroundTag":"unsupported-platform","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"}