Repository navigation
Description
What happened
I swapped the RTX 5060 Ti in my Windows box for an RX 6500 XT and opened Unsloth Studio desktop (0.1.807-beta, backend 2026.9.3). The backend came up chat-only, which is fair enough:
GPUs are present on this host but PyTorch cannot use them (torch_cuda_unavailable, installed 2.10.0+cu130); Train/Export disabled (chat-only). Repair the installation to restore GPU support.
So I ran the update. Setup figured out the host was AMD now and decided to rebuild the venv. That is where it went wrong:
gpu AMD ROCm (gfx1034)
Python found: <studio_home>\unsloth_studio\Scripts\python.exe
Stale venv detected (torch cu130 != required rocm) -- rebuilding...
[ERROR] Could not remove stale venv: Access to the path 'python.exe' is denied.
Close any running Unsloth/Python processes and re-run setup.
[TAURI:ERROR] Could not remove the stale environment at <studio_home>\unsloth_studio
Manual recovery copy retained at: <studio_home>\unsloth_studio\Scripts\unsloth.exe.update-backup
After that the venv had Scripts\python.exe and almost nothing else. Starting the backend gave ModuleNotFoundError: No module named 'unsloth_cli', and so did the update-based repair, because both of them start from that same interpreter.
Then a second, smaller thing. The startup screen showed Retry, I pressed it a handful of times, and the diagnostics report ended up with five repair groups: one actually running the bundled installer (which succeeded about four minutes later), and four that failed with Installation is already running. The UI showed me the failure, so it looked like the repair was broken while it was in fact working.
Why
The half-delete. unsloth studio update runs setup.ps1 from the managed venv's own python.exe. The desktop spawns python.exe -c "from unsloth_cli import app" studio update, the CLI's _run_setup_script Popens PowerShell and waits. So the venv interpreter is always an ancestor of setup.ps1. The direct-update stale branch does Remove-Item -LiteralPath $VenvDir -Recurse -Force, and Windows will not delete a running executable, so it removes everything it can reach and then fails on python.exe. "Close any running Unsloth/Python processes" cannot be followed: the process holding the file is the one running the update.
I checked the mechanism on its own with a throwaway venv whose python was sleeping: Rename-Item on the directory succeeds (whole tree, atomically), Remove-Item -Recurse deletes every sibling and stops at the exe. tests/studio/test_amd_venv_repair_loop.ps1 already says this about the install.ps1-managed branch ("install.ps1 runs setup through the venv's own unsloth.exe"), and that branch was changed to reinstall torch in place. The direct-update branch has the same shape and still deletes.
The duplicate repairs. Retry calls checkInstallAndStart, which runs the preflight. Every preflight came back managed_stale with can_auto_repair, and every one started a repair. On the Rust side start_managed_repair only checks whether an install or update child process exists, and none does while it is stopping the backend or between the update child exiting and the installer spawning, so all five got through:
19:08:50 desktop_preflight completed disposition=ManagedStale port=None in 2017ms
19:08:50 start_managed_repair command called (force_installer=false)
19:08:51 desktop_preflight completed disposition=ManagedStale port=None in 2007ms
19:08:51 start_managed_repair command called (force_installer=false)
19:08:52 desktop_preflight completed disposition=ManagedStale port=None in 2016ms
19:08:52 start_managed_repair command called (force_installer=false)
19:08:52 desktop_preflight completed disposition=ManagedStale port=None in 2007ms
19:08:52 start_managed_repair command called (force_installer=false)
19:08:52 desktop_preflight completed disposition=ManagedStale port=None in 2011ms
19:08:52 start_managed_repair command called (force_installer=false)
...
19:08:54 [install] Starting installation...
19:08:55 [ERROR] Managed repair installer failed: Installation is already running.
19:08:56 [ERROR] Managed repair installer failed: Installation is already running.
19:08:56 [ERROR] Managed repair installer failed: Installation is already running.
19:08:56 [ERROR] Managed repair installer failed: Installation is already running.
Environment
- Windows 11 Home 10.0.26200, Unsloth Studio desktop 0.1.807-beta, backend 2026.9.3
- AMD Radeon RX 6500 XT (gfx1034), driver 32.0.21030.2001, previously an RTX 5060 Ti in the same install
- Python 3.13.13 venv at
~/.unsloth/studio/unsloth_studio
Fixes
Two PRs: #11248 for the half-delete, #11249 for the duplicate repairs. The first one is the one that matters: any Windows user whose torch flavor stops matching the host loses their venv on update. The second is cosmetic by comparison but it is what made the repair look broken.
Activity