fix: also check uv-managed Python 3.12 for AMD ROCm #5301

This commit is contained in:
LeoBorcherding 2026-05-08 03:20:06 -05:00
commit bafb3f54df

View file

@ -1304,7 +1304,7 @@ shell.Run cmd, 0, False
}
} catch {}
}
# 2. Try PATH (catches uv-managed or manually placed python3.12 / python)
# 2. Try PATH (catches manually placed python3.12 / python)
if (-not $py312) {
foreach ($name in @("python3.12", "python3", "python")) {
foreach ($cmd in @(Get-Command $name -All -ErrorAction SilentlyContinue)) {
@ -1322,6 +1322,21 @@ shell.Run cmd, 0, False
if ($py312) { break }
}
}
# 3. Ask uv for its managed Python 3.12 (uv installs don't appear in PATH or py.exe)
if (-not $py312) {
$uvCmd = Get-Command uv -ErrorAction SilentlyContinue
if ($uvCmd) {
try {
$uvPy = (& $uvCmd.Source python find 3.12 2>$null | Out-String).Trim()
if ($uvPy -and (Test-Path $uvPy) -and -not (Test-IsCondaPython $uvPy)) {
$verOut = (& $uvPy --version 2>&1 | Out-String)
if ($verOut -match "Python 3\.12\.\d+") {
$py312 = @{ Version = "3.12"; Path = $uvPy }
}
}
} catch {}
}
}
if ($py312) {
$DetectedPython = $py312
substep "AMD ROCm detected -- switching to Python 3.12 (ROCm wheels are cp312-only)" "Cyan"