fix(studio): install unsloth and unsloth_zoo from git main#4794
fix(studio): install unsloth and unsloth_zoo from git main#4794danielhanchen wants to merge 2 commits intomainfrom
Conversation
The latest PyPI releases of unsloth and unsloth_zoo do not include recent fixes needed by Studio (Gemma 4 support, compiler patches). Switch all install paths to pull from git main until the next PyPI release is cut. Changes: - install.sh: add _DEFAULT_UNSLOTH_PKG / _DEFAULT_ZOO_PKG defaults, replace 7 hardcoded "unsloth>=2026.3.18" / "unsloth-zoo" references - install.ps1: same pattern with $DefaultUnslothPkg / $DefaultZooPkg - install_python_stack.py: add _DEFAULT_UNSLOTH_PKG / _DEFAULT_ZOO_PKG, update the no-torch install path - base.txt: switch from package names to git+https URLs To revert: change the defaults back to "unsloth>=2026.3.18" and "unsloth-zoo" in all four files and restore base.txt to package names.
There was a problem hiding this comment.
Code Review
This pull request updates the installation scripts (PowerShell and Bash) and requirements files to temporarily pull 'unsloth' and 'unsloth-zoo' directly from their respective GitHub repositories instead of PyPI. The review feedback highlights several inconsistencies in the installation commands, specifically recommending the addition of missing '--upgrade-package' flags and consolidating redundant code blocks to ensure reliable updates across all installation paths.
install.ps1
Outdated
| } elseif ($StudioLocalInstall) { | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth "unsloth>=2026.3.18" unsloth-zoo } | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth $DefaultUnslothPkg $DefaultZooPkg } | ||
| } else { | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth "$PackageName" } | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth $DefaultUnslothPkg $DefaultZooPkg } | ||
| } |
There was a problem hiding this comment.
The elseif ($StudioLocalInstall) and else blocks are now identical in their primary installation command. These can be merged into a single else block to simplify the logic. Additionally, --upgrade-package unsloth-zoo should be added to ensure both packages are correctly updated from their git URLs, maintaining consistency with the SkipTorch path at line 866.
} else {
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth --upgrade-package unsloth-zoo $DefaultUnslothPkg $DefaultZooPkg }
}
install.ps1
Outdated
| substep "installing unsloth (this may take a few minutes)..." | ||
| if ($StudioLocalInstall) { | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython unsloth-zoo "unsloth>=2026.3.18" --torch-backend=auto } | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython $DefaultZooPkg $DefaultUnslothPkg --torch-backend=auto } |
There was a problem hiding this comment.
In this fallback path, the --upgrade-package flags are missing. While uv often handles URL-based installs correctly, being explicit ensures that existing installations are replaced by the git main versions during an update. Also, consider keeping the package order consistent (Unsloth then Zoo) with other parts of the script.
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth --upgrade-package unsloth-zoo $DefaultUnslothPkg $DefaultZooPkg --torch-backend=auto }
install.sh
Outdated
| elif [ "$STUDIO_LOCAL_INSTALL" = true ]; then | ||
| run_install_cmd "install unsloth (local)" uv pip install --python "$_VENV_PY" \ | ||
| --upgrade-package unsloth "unsloth>=2026.3.18" unsloth-zoo | ||
| --upgrade-package unsloth "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG" |
There was a problem hiding this comment.
This command is missing the --upgrade-package unsloth-zoo flag. To ensure both packages are properly updated from git, both should be explicitly marked for upgrade, as seen in the no-torch path at line 1080.
| --upgrade-package unsloth "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG" | |
| --upgrade-package unsloth --upgrade-package unsloth-zoo "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG" |
install.sh
Outdated
| run_install_cmd "overlay local repo" uv pip install --python "$_VENV_PY" -e "$_REPO_ROOT" --no-deps | ||
| else | ||
| run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" "$PACKAGE_NAME" --torch-backend=auto | ||
| run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG" --torch-backend=auto |
There was a problem hiding this comment.
The fallback installation path is missing the --upgrade-package flags. For consistency and to ensure updates work correctly when GPU detection fails, these flags should be included here as well.
| run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG" --torch-backend=auto | |
| run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" --upgrade-package unsloth --upgrade-package unsloth-zoo "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG" --torch-backend=auto |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a484032f92
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
install.sh
Outdated
| run_install_cmd "install unsloth" uv pip install --python "$_VENV_PY" \ | ||
| --upgrade-package unsloth "$PACKAGE_NAME" | ||
| --upgrade-package unsloth "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG" |
There was a problem hiding this comment.
Honor --package override when installing base package
This branch no longer uses PACKAGE_NAME, so install.sh --package <name> now always installs the hardcoded Git defaults instead of the requested package. That is a behavior regression because --package is still parsed and documented as a test/fork path, and SKIP_STUDIO_BASE=1 means install_python_stack.py will not later correct it. In practice, users testing a fork/package alias will silently get upstream unsloth from GitHub main.
Useful? React with 👍 / 👎.
- Add missing --upgrade-package unsloth-zoo flag to local, default, and fallback install paths in install.sh and install.ps1 - Merge identical elseif/else branches in install.ps1 fallback section - Merge identical StudioLocalInstall/default branches in install.ps1 fresh-env section into a single else block - Honor --package override in install.sh so custom package names (fork/test aliases) are not silently replaced by git defaults - Consistent package order (unsloth then zoo) across all paths
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d20440341
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth "unsloth>=2026.3.18" unsloth-zoo } | ||
| } else { | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth "$PackageName" } | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth --upgrade-package unsloth-zoo $DefaultUnslothPkg $DefaultZooPkg } |
There was a problem hiding this comment.
Honor --package override in Windows installer
install.ps1 still parses --package, but the base install now always uses $DefaultUnslothPkg/$DefaultZooPkg, so users testing a fork (for example --package roland-sloth) will silently install the default git unsloth instead. This is a regression from the previous behavior where the non-local install path used $PackageName, and it matters because SKIP_STUDIO_BASE=1 means the later setup step does not reinstall base packages.
Useful? React with 👍 / 👎.
| "unsloth", | ||
| "--upgrade-package", | ||
| "unsloth-zoo", | ||
| package_name, | ||
| "unsloth-zoo", | ||
| _DEFAULT_UNSLOTH_PKG, | ||
| _DEFAULT_ZOO_PKG, |
There was a problem hiding this comment.
Preserve custom package name in no-torch update path
In install_python_stack.py, the no-torch branch now hardcodes unsloth plus _DEFAULT_UNSLOTH_PKG, so STUDIO_PACKAGE_NAME is ignored whenever NO_TORCH is true (for example Intel macOS updates or UNSLOTH_NO_TORCH=true). Previously this branch used package_name, so custom package testing via unsloth studio update --package <name> regresses specifically in no-torch environments.
Useful? React with 👍 / 👎.
Summary
git+https://github.com/unslothai/unsloth.gitandgit+https://github.com/unslothai/unsloth_zoo.gitinstead of PyPI package names_DEFAULT_LLAMA_TAGfrom fix(studio): build llama.cpp from master for Gemma 4 support #4790), making it easy to revert once a new PyPI release is cutChanges
install.sh: add_DEFAULT_UNSLOTH_PKG/_DEFAULT_ZOO_PKGdefaults, replace 7 hardcoded"unsloth>=2026.3.18"/"unsloth-zoo"referencesinstall.ps1: same pattern with$DefaultUnslothPkg/$DefaultZooPkgstudio/install_python_stack.py: add_DEFAULT_UNSLOTH_PKG/_DEFAULT_ZOO_PKG, update the no-torch install pathstudio/backend/requirements/base.txt: switch from package names togit+httpsURLsReverting
Change the defaults back to
"unsloth>=2026.3.18"and"unsloth-zoo"in all four files, and restorebase.txtto plain package names.Test plan
install.shpulls unsloth and unsloth_zoo from git maininstall.ps1(Windows) pulls from git mainunsloth studio update(callsinstall_python_stack.py) pulls from git main--no-torch) pulls from git main--local) still overlays editable install on top of git main