Skip to content

Fix unsloth run on Windows: the venv entry point is unsloth.exe - #7718

Merged
danielhanchen merged 2 commits into
mainfrom
pr-win-entry
Aug 1, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
pr-win-entry

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

unsloth run is unusable on Windows.

When it is not already inside the studio venv it re-execs through that venv's console script, and it resolved the path as:

studio_bin = studio_python.parent / "unsloth"

Windows installs that console script as unsloth.exe, and only as unsloth.exe. install.ps1 writes Scripts\unsloth.exe (a distlib launcher) and hardlinks it to %STUDIO_HOME%\bin\unsloth.exe; no extensionless file, no .bat and no .cmd is ever created. So the bare name could never be a file, studio_bin.is_file() was always false, and the command bailed out with

Unsloth venv missing 'unsloth' entry point. Re-run: unsloth studio setup

on an install that was perfectly healthy. Re-running setup does not help, because setup was never the problem.

When it is reached

Worth being precise, because the happy path hides it. Launching through the installer's own shim puts sys.prefix inside the studio venv, so in_studio_venv is true and this whole block is skipped. The failure needs unsloth run to be invoked from outside that venv, which is the shadowed-PATH case: a separately pip installed unsloth earlier on PATH than the installer's shim. studio/backend/run.py already calls that scenario out by name ("another 'unsloth' on PATH is shadowing the installer's binary"), so it is a real configuration rather than a hypothetical one, and on Windows it was fatal where on Linux and macOS it works.

Fixed by picking the name per platform, the same way _looks_like_installer_managed_studio_home already does a few lines above in the same file:

shim_name = "unsloth.exe" if platform.system() == "Windows" else "unsloth"

Testing

tests/studio/test_run_windows_entry_point.py, 2 tests. They are AST based, following the existing tests/studio/test_cli_run_alias.py, because reaching that assignment at runtime means standing up a real studio venv. One pins that the name is chosen between unsloth and unsloth.exe, the other that the .exe branch is the one gated on platform.system() == "Windows", so a swapped conditional does not slip through.

Both fail against the previous line and pass with it. Verified end to end on windows-latest with an installed desktop bundle, where unsloth run now starts and serves instead of aborting.

danielhanchen and others added 2 commits August 1, 2026 07:03
The re-exec into the studio venv resolved studio_python.parent / "unsloth".
Windows installs that console script as unsloth.exe, so is_file() was always
false and every Windows run aborted with "Unsloth venv missing 'unsloth' entry
point" on an install that was fine. Pick the name per platform, as
_studio_shim_path already does.
@danielhanchen
danielhanchen merged commit 9fe5dd9 into main Aug 1, 2026
83 of 87 checks passed
@danielhanchen
danielhanchen deleted the pr-win-entry branch August 1, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant