fix(studio): temporarily install unsloth and unsloth_zoo from git main

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.
This commit is contained in:
Daniel Han 2026-04-02 18:02:59 +00:00
commit a484032f92
4 changed files with 45 additions and 19 deletions

View file

@ -8,6 +8,12 @@ function Install-UnslothStudio {
$ErrorActionPreference = "Stop"
$script:UnslothVerbose = ($env:UNSLOTH_VERBOSE -eq "1")
# ── Maintainer-editable defaults ──
# Temporarily install from git main instead of PyPI.
# Revert to "unsloth>=2026.3.18" / "unsloth-zoo" once a new release is cut.
$DefaultUnslothPkg = "git+https://github.com/unslothai/unsloth.git"
$DefaultZooPkg = "git+https://github.com/unslothai/unsloth_zoo.git"
# ── Parse flags ──
$StudioLocalInstall = $false
$PackageName = "unsloth"
@ -819,7 +825,7 @@ shell.Run cmd, 0, False
if ($SkipTorch) {
# No-torch: install unsloth + unsloth-zoo with --no-deps, then
# runtime deps (typer, safetensors, transformers, etc.) with --no-deps.
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --no-deps --reinstall-package unsloth --reinstall-package unsloth-zoo "unsloth>=2026.3.18" unsloth-zoo }
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --no-deps --reinstall-package unsloth --reinstall-package unsloth-zoo $DefaultUnslothPkg $DefaultZooPkg }
if ($baseInstallExit -eq 0) {
$NoTorchReq = Find-NoTorchRuntimeFile
if ($NoTorchReq) {
@ -827,7 +833,7 @@ shell.Run cmd, 0, False
}
}
} else {
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --reinstall-package unsloth --reinstall-package unsloth-zoo "unsloth>=2026.3.18" unsloth-zoo }
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --reinstall-package unsloth --reinstall-package unsloth-zoo $DefaultUnslothPkg $DefaultZooPkg }
}
if ($baseInstallExit -ne 0) {
Write-Host "[ERROR] Failed to install unsloth (exit code $baseInstallExit)" -ForegroundColor Red
@ -857,7 +863,7 @@ shell.Run cmd, 0, False
if ($SkipTorch) {
# No-torch: install unsloth + unsloth-zoo with --no-deps, then
# runtime deps (typer, safetensors, transformers, etc.) with --no-deps.
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --no-deps --upgrade-package unsloth --upgrade-package unsloth-zoo "unsloth>=2026.3.18" unsloth-zoo }
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --no-deps --upgrade-package unsloth --upgrade-package unsloth-zoo $DefaultUnslothPkg $DefaultZooPkg }
if ($baseInstallExit -eq 0) {
$NoTorchReq = Find-NoTorchRuntimeFile
if ($NoTorchReq) {
@ -865,9 +871,9 @@ shell.Run cmd, 0, False
}
}
} 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 }
}
if ($baseInstallExit -ne 0) {
Write-Host "[ERROR] Failed to install unsloth (exit code $baseInstallExit)" -ForegroundColor Red
@ -886,7 +892,7 @@ shell.Run cmd, 0, False
# Fallback: GPU detection failed to produce a URL -- let uv resolve torch
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 }
if ($baseInstallExit -ne 0) {
Write-Host "[ERROR] Failed to install unsloth (exit code $baseInstallExit)" -ForegroundColor Red
return
@ -898,7 +904,7 @@ shell.Run cmd, 0, False
return
}
} else {
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython "$PackageName" --torch-backend=auto }
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython $DefaultUnslothPkg $DefaultZooPkg --torch-backend=auto }
if ($baseInstallExit -ne 0) {
Write-Host "[ERROR] Failed to install unsloth (exit code $baseInstallExit)" -ForegroundColor Red
return

View file

@ -32,6 +32,14 @@ fi
step() { printf " ${C_DIM}%-15.15s${C_RST}${3:-$C_OK}%s${C_RST}\n" "$1" "$2"; }
substep() { printf " ${C_DIM}%-15s${2:-$C_DIM}%s${C_RST}\n" "" "$1"; }
# ── Maintainer-editable defaults ──
# Temporarily install from git main instead of PyPI.
# Revert to "unsloth>=2026.3.18" / "unsloth-zoo" once a new release is cut.
# _DEFAULT_UNSLOTH_PKG="unsloth>=2026.3.18"
# _DEFAULT_ZOO_PKG="unsloth-zoo"
_DEFAULT_UNSLOTH_PKG="git+https://github.com/unslothai/unsloth.git"
_DEFAULT_ZOO_PKG="git+https://github.com/unslothai/unsloth_zoo.git"
# ── Parse flags ──
STUDIO_LOCAL_INSTALL=false
PACKAGE_NAME="unsloth"
@ -1040,7 +1048,7 @@ if [ "$_MIGRATED" = true ]; then
# to prevent transitive torch resolution.
run_install_cmd "install unsloth (migrated no-torch)" uv pip install --python "$_VENV_PY" --no-deps \
--reinstall-package unsloth --reinstall-package unsloth-zoo \
"unsloth>=2026.3.18" unsloth-zoo
"$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG"
_NO_TORCH_RT="$(_find_no_torch_runtime)"
if [ -n "$_NO_TORCH_RT" ]; then
run_install_cmd "install no-torch runtime deps" uv pip install --python "$_VENV_PY" --no-deps -r "$_NO_TORCH_RT"
@ -1048,7 +1056,7 @@ if [ "$_MIGRATED" = true ]; then
else
run_install_cmd "install unsloth (migrated)" uv pip install --python "$_VENV_PY" \
--reinstall-package unsloth --reinstall-package unsloth-zoo \
"unsloth>=2026.3.18" unsloth-zoo
"$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG"
fi
if [ "$STUDIO_LOCAL_INSTALL" = true ]; then
substep "overlaying local repo (editable)..."
@ -1070,7 +1078,7 @@ elif [ -n "$TORCH_INDEX_URL" ]; then
# runtime deps (typer, safetensors, transformers, etc.) with --no-deps.
run_install_cmd "install unsloth (no-torch)" uv pip install --python "$_VENV_PY" --no-deps \
--upgrade-package unsloth --upgrade-package unsloth-zoo \
"unsloth>=2026.3.18" unsloth-zoo
"$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG"
_NO_TORCH_RT="$(_find_no_torch_runtime)"
if [ -n "$_NO_TORCH_RT" ]; then
run_install_cmd "install no-torch runtime deps" uv pip install --python "$_VENV_PY" --no-deps -r "$_NO_TORCH_RT"
@ -1081,22 +1089,22 @@ elif [ -n "$TORCH_INDEX_URL" ]; then
fi
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"
substep "overlaying local repo (editable)..."
run_install_cmd "overlay local repo" uv pip install --python "$_VENV_PY" -e "$_REPO_ROOT" --no-deps
else
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"
fi
else
# Fallback: GPU detection failed to produce a URL -- let uv resolve torch
substep "installing unsloth (this may take a few minutes)..."
if [ "$STUDIO_LOCAL_INSTALL" = true ]; then
run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" unsloth-zoo "unsloth>=2026.3.18" --torch-backend=auto
run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" "$_DEFAULT_ZOO_PKG" "$_DEFAULT_UNSLOTH_PKG" --torch-backend=auto
substep "overlaying local repo (editable)..."
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
fi
fi

View file

@ -1,3 +1,6 @@
# Core unsloth packages
unsloth-zoo
unsloth
# Temporarily install from git main instead of PyPI to pick up latest
# fixes (Gemma 4 support, Studio patches). Revert to package names
# once the next PyPI release is cut.
git+https://github.com/unslothai/unsloth_zoo.git
git+https://github.com/unslothai/unsloth.git

View file

@ -42,6 +42,15 @@ def _infer_no_torch() -> bool:
NO_TORCH = _infer_no_torch()
# -- Maintainer-editable package defaults --------------------------------------
# Temporarily install from git main instead of PyPI to pick up latest fixes
# (Gemma 4 support, Studio patches). Revert to PyPI package names once the
# next release is cut.
# PyPI: _DEFAULT_UNSLOTH_PKG = "unsloth"
# _DEFAULT_ZOO_PKG = "unsloth-zoo"
_DEFAULT_UNSLOTH_PKG = "git+https://github.com/unslothai/unsloth.git"
_DEFAULT_ZOO_PKG = "git+https://github.com/unslothai/unsloth_zoo.git"
# -- Verbosity control ----------------------------------------------------------
# By default the installer shows a minimal progress bar (one line, in-place).
# Set UNSLOTH_VERBOSE=1 in the environment to restore full per-step output:
@ -471,11 +480,11 @@ def install_python_stack() -> int:
"--no-cache-dir",
"--no-deps",
"--upgrade-package",
package_name,
"unsloth",
"--upgrade-package",
"unsloth-zoo",
package_name,
"unsloth-zoo",
_DEFAULT_UNSLOTH_PKG,
_DEFAULT_ZOO_PKG,
)
pip_install(
"Installing no-torch runtime deps",