From 4b2f7fb8e21c575036f05862a92a1c0af2445518 Mon Sep 17 00:00:00 2001 From: LeoBorcherding Date: Wed, 6 May 2026 20:31:55 -0500 Subject: [PATCH] fix: hoist global declaration to top of _ensure_rocm_torch Python requires the global statement to appear before any assignment to the variable within a function. Moving it to the function top fixes the SyntaxError on line 354. --- studio/install_python_stack.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/studio/install_python_stack.py b/studio/install_python_stack.py index b2c6f9bd1a..101978b362 100644 --- a/studio/install_python_stack.py +++ b/studio/install_python_stack.py @@ -285,6 +285,7 @@ def _ensure_rocm_torch() -> None: already links against HIP. Uses pip_install() to respect uv, constraints, and --python targeting. """ + global _rocm_windows_torch_installed if IS_MACOS: return @@ -317,7 +318,6 @@ def _ensure_rocm_torch() -> None: timeout = 30, ) if probe.returncode == 0 and probe.stdout.decode().strip() == "yes": - global _rocm_windows_torch_installed _rocm_windows_torch_installed = True return # already ROCm torch except (OSError, subprocess.TimeoutExpired): @@ -351,7 +351,6 @@ def _ensure_rocm_torch() -> None: *wheel_urls, constrain = False, ) - global _rocm_windows_torch_installed _rocm_windows_torch_installed = True return