LykosAI/StabilityMatrix · error · InvalidOperationException
Installed torch is not a usable ROCm build. Verification…
Error message
Installed torch is not a usable ROCm build. Verification output: {verificationOutput} What it means
The verification JSON parsed successfully, but IsUsableWindowsNativeTorchBuild rejected the version/hip combination — the installed torch is not a usable ROCm build (e.g. a CPU-only or CUDA torch got installed where a ROCm wheel was expected). The helper throws with the full verification output so the actual versions are visible.
Solutions
- Check the verification output in the message for the installed torch version and whether it carries a +rocm build tag and hip version.
- Reinstall with the explicit ROCm wheel index (pip install torch --index-url https://download.pytorch.org/whl/rocm<ver>) so the ROCm build is actually selected.
- Clear the pip cache or force --force-reinstall to avoid a stale CPU/CUDA wheel being reused.
- Pin torchvision/torch versions compatible with the app's expected ROCm build and retry the install.
Example fix
// before: pip resolved CPU wheel pip install torch torchvision // after: force ROCm build from the ROCm index pip install --force-reinstall torch torchvision --index-url https://download.pytorch.org/whl/rocm5.7
Defensive patterns
Strategy: validation
Validate before calling
var (torch, hip) = await ProbeTorchAsync();
if (!(torch?.EndsWith("+rocm", StringComparison.OrdinalIgnoreCase) ?? false) || hip is null)
throw new InvalidOperationException($"Torch is not a ROCm build: {torch}, hip={hip}"); Type guard
static bool IsRocmBuild(string? version) =>
version?.Contains("+rocm", StringComparison.OrdinalIgnoreCase) == true; Try / catch
try { await helper.InstallWindowsNativeTorchAsync(...); }
catch (InvalidOperationException ex) when (ex.Message.StartsWith("Installed torch is not a usable ROCm build"))
{
logger.Warning(ex, "Non-ROCm torch installed; reinstalling from ROCm index");
await ReinstallRocmTorchAsync();
} Prevention
- Always install torch with the explicit ROCm wheel index URL.
- Force reinstall to prevent cached CPU/CUDA wheels from being reused.
- Verify the '+rocm' build tag and hip version after every torch upgrade.
- Prevent other tools from silently upgrading torch to a non-ROCm build.
When it happens
Trigger: InstallWindowsNativeTorchAsync -> VerifyWindowsNativeTorchInstallAsync after pip installs the ROCm torch wheels, when the reported torch/torchvision versions fail IsUsableWindowsNativeTorchBuild (wrong version, missing '+rocm' build tag, or no hip version).
Common situations: pip resolved to a CPU or CUDA wheel because the ROCm index URL was wrong or unavailable; a cached wheel of the wrong variant was reused; the ROCm wheel index no longer hosts the pinned version; torch was upgraded afterwards by another tool, dropping the +rocm tag.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- torch is not installed in this environment. Install the…
- Installed torch is not a usable Windows ROCm build
- torch was not installed after Windows ROCm setup.
- Torch verification produced no output.
- Unexpected torch verification output
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/271b7844dcb0a879.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Services/Rocm/RocmPackageHelper.cs:478
{
throw new InvalidOperationException(
$"Unexpected torch verification output: {verificationOutput}",
exception
);
}
using (verificationDocument)
{
var root = verificationDocument.RootElement;
var version = root.TryGetProperty("version", out var versionElement)
? versionElement.GetString()
: null;
var hipVersion = root.TryGetProperty("hip", out var hipElement) ? hipElement.GetString() : null;
var cudaAvailable = root.TryGetProperty("cuda", out var cudaElement) && cudaElement.GetBoolean();
if (!IsUsableWindowsNativeTorchBuild(version, hipVersion))
{
throw new InvalidOperationException(
$"Installed torch is not a usable ROCm build. Verification output: {verificationOutput}"
);
}
if (!cudaAvailable)
{
onConsoleOutput?.Invoke(
ProcessOutput.FromStdErrLine(
$"Torch verification warning: installed ROCm torch build reported cuda={cudaAvailable}; continuing because ROCm metadata was detected (version={version}, hip={hipVersion})."
)
);
}
onConsoleOutput?.Invoke(
ProcessOutput.FromStdOutLine(
$"Torch verification: version={version}, hip={hipVersion}, cuda={cudaAvailable}"
)
);View on GitHub (pinned to af93d6ef57)