Skip to content

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

Closed
danielhanchen wants to merge 2 commits intomainfrom
fix/studio-install-from-git-main
Closed

fix(studio): install unsloth and unsloth_zoo from git main#4794
danielhanchen wants to merge 2 commits intomainfrom
fix/studio-install-from-git-main

Conversation

@danielhanchen
Copy link
Copy Markdown
Contributor

Summary

  • Latest PyPI releases of unsloth and unsloth_zoo are missing recent fixes needed by Studio (Gemma 4 support, compiler patches)
  • Switch all install paths to pull from git+https://github.com/unslothai/unsloth.git and git+https://github.com/unslothai/unsloth_zoo.git instead of PyPI package names
  • Uses maintainer-editable defaults at the top of each file (same pattern as _DEFAULT_LLAMA_TAG from fix(studio): build llama.cpp from master for Gemma 4 support #4790), making it easy to revert once a new 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
  • studio/install_python_stack.py: add _DEFAULT_UNSLOTH_PKG / _DEFAULT_ZOO_PKG, update the no-torch install path
  • studio/backend/requirements/base.txt: switch from package names to git+https URLs

Reverting

Change the defaults back to "unsloth>=2026.3.18" and "unsloth-zoo" in all four files, and restore base.txt to plain package names.

Test plan

  • Fresh install via install.sh pulls unsloth and unsloth_zoo from git main
  • Fresh install via install.ps1 (Windows) pulls from git main
  • unsloth studio update (calls install_python_stack.py) pulls from git main
  • No-torch path (Intel Mac, --no-torch) pulls from git main
  • Local dev path (--local) still overlays editable install on top of 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.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Comment on lines 873 to 877
} 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 }
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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 }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
--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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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
Comment on lines +1096 to +1097
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"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +483 to +487
"unsloth",
"--upgrade-package",
"unsloth-zoo",
package_name,
"unsloth-zoo",
_DEFAULT_UNSLOTH_PKG,
_DEFAULT_ZOO_PKG,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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