LykosAI/StabilityMatrix · error · MissingPrerequisiteException

Could not find CUDA Toolkit. Please install version 12.6 or…

Error message

Could not find CUDA Toolkit. Please install version 12.6 or newer from the link below.

What it means

Compiling Triton/SageAttention from source requires the NVIDIA CUDA Toolkit; the step checks the standard v12.6 and v12.8 install paths and throws MissingPrerequisiteException if neither exists.

Solutions

  1. Install CUDA Toolkit 12.6+ from https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64 to the default path
  2. If CUDA is already installed elsewhere, add/verify the standard path or update the expected paths in the step
  3. Ensure the installed CUDA major.minor is 12.6 or 12.8 which the step recognizes
Defensive patterns

Strategy: validation

Validate before calling

bool cudaOk = Directory.Exists(@"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin")
           || Directory.Exists(@"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\bin");
if (!cudaOk) promptCudaInstall();

Try / catch

try { await step.ExecuteAsync(progress); } catch (MissingPrerequisiteException ex) { ui.ShowPrerequisiteDialog(ex.Name, ex.Message, ex.Url); }

Prevention

When it happens

Trigger: ExecuteAsync reaches the source-build path on Windows and neither C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin nor v12.8\bin exists.

Common situations: CUDA Toolkit not installed; CUDA installed in a non-default directory (so the path check misses it); a CUDA version outside 12.6/12.8 (e.g. 11.x or 13.x) installed at a different path.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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

Appendix: source

Thrown at StabilityMatrix.Core/Models/PackageModification/InstallSageAttentionStep.cs:161

                "Visual Studio 2022 Build Tools",
                "Could not find Visual Studio 2022 Build Tools. Please install them from the link below.",
                "https://aka.ms/vs/17/release/vs_BuildTools.exe"
            );
        }

        var nvccPath = await Utilities.WhichAsync("nvcc").ConfigureAwait(false);
        if (string.IsNullOrWhiteSpace(nvccPath))
        {
            var cuda126ExpectedPath = new DirectoryPath(
                @"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin"
            );
            var cuda128ExpectedPath = new DirectoryPath(
                @"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\bin"
            );

            if (!cuda126ExpectedPath.Exists && !cuda128ExpectedPath.Exists)
            {
                throw new MissingPrerequisiteException(
                    "CUDA Toolkit",
                    "Could not find CUDA Toolkit. Please install version 12.6 or newer from the link below.",
                    "https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64"
                );
            }

            nvccPath = cuda128ExpectedPath.Exists
                ? cuda128ExpectedPath.JoinFile("nvcc.exe").ToString()
                : cuda126ExpectedPath.JoinFile("nvcc.exe").ToString();
        }

        venvRunner.UpdateEnvironmentVariables(env =>
        {
            var cudaBinPath = Path.GetDirectoryName(nvccPath)!;
            var cudaHome = Path.GetDirectoryName(cudaBinPath)!;

            env = env.TryGetValue("PATH", out var pathValue)
                ? env.SetItem("PATH", $"{cudaBinPath}{Path.PathSeparator}{pathValue}")

View on GitHub (pinned to af93d6ef57)