Repository navigation
Fix unsloth run on Windows: the venv entry point is unsloth.exe - #7718
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
unsloth runis 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:
Windows installs that console script as
unsloth.exe, and only asunsloth.exe.install.ps1writesScripts\unsloth.exe(a distlib launcher) and hardlinks it to%STUDIO_HOME%\bin\unsloth.exe; no extensionless file, no.batand no.cmdis ever created. So the bare name could never be a file,studio_bin.is_file()was always false, and the command bailed out withon 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.prefixinside the studio venv, soin_studio_venvis true and this whole block is skipped. The failure needsunsloth runto be invoked from outside that venv, which is the shadowed-PATH case: a separatelypip installedunslothearlier on PATH than the installer's shim.studio/backend/run.pyalready 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_homealready does a few lines above in the same file:Testing
tests/studio/test_run_windows_entry_point.py, 2 tests. They are AST based, following the existingtests/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 betweenunslothandunsloth.exe, the other that the.exebranch is the one gated onplatform.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-latestwith an installed desktop bundle, whereunsloth runnow starts and serves instead of aborting.