Fix Install commands for Windows + 1 line installs#4447
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b541102f44
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| $ActivateScript = Join-Path $VenvName "Scripts\activate.ps1" | ||
| if (Test-Path $ActivateScript) { | ||
| & $ActivateScript |
There was a problem hiding this comment.
Avoid invoking Activate.ps1 without bypassing policy
On Windows hosts where PowerShell script execution is locked down, the new one-liner will stop at & $ActivateScript before uv pip install or unsloth studio setup ever run. That is especially likely here because the repo already has to launch setup.ps1 via powershell -ExecutionPolicy Bypass in unsloth_cli/commands/studio.py:172-174, so this installer is now less robust than the existing setup path. Please avoid depending on Activate.ps1 here, or run it with an execution-policy bypass, otherwise irm ... | iex fails on a common class of Windows environments.
Useful? React with 👍 / 👎.
- install.sh: detect platform (macOS/Linux/WSL) and check for missing system dependencies (cmake, git, build-essential, libcurl4-openssl-dev). Prompt user once for permission to install all missing packages via brew (macOS) or sudo apt-get (Linux/WSL). Add wget fallback via download() helper since curl is not always present on minimal Linux installs. Fix nested curl|sh stdin stealing by downloading uv installer to a tempfile first. Replace venv activation (no-op in a pipe subshell) with explicit --python flag for uv pip install and direct venv binary invocation. Add idempotency guard for venv creation. Redirect stdin on unsloth studio setup to prevent pipe consumption. On macOS, check for Xcode Command Line Tools and trigger install if missing. - install.ps1: wrap script body in Install-UnslothStudio function so that errors use return instead of exit (exit kills the terminal when run via irm|iex). Remove activate.ps1 invocation entirely -- use explicit --python path for uv pip install and & $UnslothExe for studio setup. This avoids both the child-scope activation bug (& vs dot-source) and the execution policy error on default Windows systems. Add winget availability check with clear error message. Fix PATH refresh to append registry paths instead of replacing the session PATH. Add uv installer fallback via astral.sh PowerShell script if winget install does not put uv on PATH. Broaden Python version check to accept 3.11-3.13. Add idempotency guard for venv creation. - README.md: add wget one-liner alternative for systems without curl.
|
Pushed fixes for the install scripts. Here is what changed: install.sh (Linux/Mac/WSL)
install.ps1 (Windows)
README.md
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62d144664b
ℹ️ 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".
| sudo apt-get update -y | ||
| sudo apt-get install -y $MISSING |
There was a problem hiding this comment.
Skip sudo when running apt-get as root
In the Linux/WSL dependency install path, the script always runs sudo apt-get ... when packages are missing. On Debian/Ubuntu environments that run as root and do not have sudo installed (common in containers/CI), this exits with sudo: command not found and aborts the one-liner before uv/Studio setup can finish. The installer should detect root (id -u = 0) and call apt-get directly in that case.
Useful? React with 👍 / 👎.
- Add .gitignore hiding workaround to setup.ps1 (matching existing setup.sh logic) so venv .gitignore files containing "*" don't prevent Tailwind's oxide scanner from finding .tsx source files - Add CSS size validation to setup.sh, setup.ps1, and build.sh to catch truncated Tailwind builds early - Remove stray force-rebuild overrides that made the "skip build if current" cache check dead code in both setup scripts - Add rm -rf dist to build.sh to force clean rebuilds for wheel packaging
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35abd876fa
ℹ️ 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".
| # CUDA Toolkit, Node.js, and other dependencies automatically via winget. | ||
| Write-Host "==> Running unsloth studio setup..." | ||
| $UnslothExe = Join-Path $VenvName "Scripts\unsloth.exe" | ||
| & $UnslothExe studio setup |
There was a problem hiding this comment.
Fail install when studio setup returns non-zero
This script relies on $ErrorActionPreference = "Stop", but native executables do not automatically stop the script on non-zero exit in standard PowerShell behavior, and this call does not check $LASTEXITCODE. If unsloth studio setup fails (for example due to a dependency install failure), the script can still continue to the success banner, giving users a false-positive "installed" result; add an explicit exit-code check immediately after this command.
Useful? React with 👍 / 👎.
| $VenvPython = Join-Path $VenvName "Scripts\python.exe" | ||
| if (-not (Test-Path $VenvName)) { | ||
| Write-Host "==> Creating Python ${PythonVersion} virtual environment (${VenvName})..." | ||
| uv venv $VenvName --python $PythonVersion |
There was a problem hiding this comment.
Use discovered Python version for venv creation
The installer marks Python 3.11–3.13 as compatible ($NeedPython = $false), but venv creation always requests --python 3.13. On machines that only have 3.11/3.12 and cannot download managed interpreters through uv, this fails even though the earlier compatibility check passed; use the detected compatible interpreter/version for uv venv instead of hard-coding 3.13 in this path.
Useful? React with 👍 / 👎.
- Change default Studio port from 8000 to 8888 across all entry points (run.py, studio.py, ui.py, colab.py, vite.config.ts, setup scripts) - Update launch banner: "Launching with studio venv..." to "Launching Unsloth Studio... Please wait..." - Add "Open your web browser" banner and rename labels (Local -> Local Access, External -> Worldwide Web Address) - Fix venv idempotency: check for bin/python instead of just directory existence, clean up partial venvs on retry - Fix build.sh CSS validation: handle empty CSS case that silently bypassed the check with "integer expression expected" - Fix install.sh sudo handling: try apt-get without sudo first (works when root), then escalate with per-package tracking and user prompt - Fix install.ps1: check exit code from studio setup, fail on error - Add pciutils to WSL GGUF build dependencies - Apply same smart apt-get escalation pattern to studio/setup.sh
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3810fe6de1
ℹ️ 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".
| else | ||
| echo " Please install them with your package manager, then re-run." | ||
| fi |
There was a problem hiding this comment.
Abort installer when Linux deps cannot be auto-installed
When required packages are missing on Linux/WSL and apt-get is unavailable, this branch only prints a message and then continues the one-liner install. On non-Debian distros (for example Fedora/Arch), that means the script proceeds into uv/venv/studio setup with known-missing prerequisites, causing later-stage failures and a misleading flow despite explicitly saying to re-run after manual install. This path should terminate immediately (non-zero) after the warning.
Useful? React with 👍 / 👎.
- install.ps1: detect existing Python 3.11/3.12/3.13 and use that version for venv creation instead of always forcing 3.13 - install.sh: exit with error on non-apt Linux distros when required packages cannot be auto-installed, instead of silently continuing
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f1a4bc894
ℹ️ 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".
| if (-not (Get-Command winget -ErrorAction SilentlyContinue)) { | ||
| Write-Host "Error: winget is not available." -ForegroundColor Red | ||
| Write-Host " Install it from https://aka.ms/getwinget" -ForegroundColor Yellow | ||
| Write-Host " or install Python $PythonVersion and uv manually, then re-run." -ForegroundColor Yellow | ||
| return |
There was a problem hiding this comment.
Exit PowerShell installer non-zero on fatal failures
This failure path returns from Install-UnslothStudio instead of terminating with a non-zero status, so callers can observe a successful command completion even when install prerequisites are missing. That matters for scripted installs (CI/bootstrap scripts) that rely on exit codes to detect failure. Use throw/exit 1 (or propagate an explicit non-zero return code) for fatal branches to avoid silent false-success outcomes.
Useful? React with 👍 / 👎.
| [nN]*) | ||
| echo "" | ||
| echo " Please install these packages first, then re-run Unsloth Studio setup:" | ||
| echo " sudo apt-get update -y && sudo apt-get install -y $_STILL_MISSING" | ||
| ;; |
There was a problem hiding this comment.
Stop WSL setup when dependency install is declined
When required WSL packages are missing and the user answers n, the script only prints manual apt instructions but continues executing setup. In that scenario, later llama.cpp build steps still run with known-missing prerequisites, causing delayed failures or a partially configured install despite asking the user to re-run after installing deps. This branch should exit non-zero immediately after the decline message.
Useful? React with 👍 / 👎.
install.ps1: Add $LASTEXITCODE checks after winget (Python), uv venv, and uv pip install calls. $ErrorActionPreference only catches PowerShell cmdlet errors, not native executable failures. The Python check also handles winget returning non-zero for "already installed". setup.sh: Skip llama-server build when user declines sudo or sudo is unavailable. Previously the script continued to section 8 which would fail with confusing errors (e.g. "gcc: command not found") since build-essential was never installed.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c8b7bfa86
ℹ️ 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".
| if [ "$_NEED_FRONTEND_BUILD" = false ]; then | ||
| echo "✅ Frontend already built and up to date -- skipping Node/npm check." |
There was a problem hiding this comment.
Install Node runtime even when frontend rebuild is skipped
After removing the unconditional _NEED_FRONTEND_BUILD=true, this branch now bypasses Node/npm setup whenever frontend/dist appears current. On fresh pip installs (where dist is bundled), that can leave npm absent, so the later oxc-validator install block is skipped and JS/TS local-callable validation falls back to invalid results when node cannot run (see studio/backend/core/data_recipe/local_callable_validators.py::_run_oxc_batch). This makes setup look successful while a supported validation path is non-functional.
Useful? React with 👍 / 👎.
| rm -rf "$LLAMA_CPP_DIR" | ||
| if [ "${_SKIP_GGUF_BUILD:-}" = true ]; then |
There was a problem hiding this comment.
Keep existing llama.cpp binaries when GGUF build is skipped
_SKIP_GGUF_BUILD is set when WSL dependency installation is declined or cannot run, but the script deletes ~/.unsloth/llama.cpp before checking that flag. In that path, rerunning setup removes previously working llama-server/llama-quantize binaries and then skips rebuilding them, which silently regresses GGUF inference/export until setup is rerun with dependencies installed.
Useful? React with 👍 / 👎.
When _SKIP_GGUF_BUILD is set (user declined sudo or sudo unavailable), the previous rm -rf would destroy an already-working llama-server before the skip check ran. Move it inside the else branch so existing builds are preserved when the rebuild is skipped.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aff47364c1
ℹ️ 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".
| trap - EXIT | ||
|
|
||
| # Validate CSS output -- catch truncated Tailwind builds before packaging | ||
| MAX_CSS_SIZE=$(find dist/assets -name '*.css' -exec wc -c {} + 2>/dev/null | sort -n | tail -1 | awk '{print $1}') |
There was a problem hiding this comment.
Exclude wc totals when validating frontend CSS size
The new CSS guard computes MAX_CSS_SIZE with find ... -exec wc -c {} + | sort -n | tail -1, but wc adds a total row when multiple files are passed at once. That means this check compares against aggregate CSS bytes, not the largest single file as intended, so a truncated Tailwind build split across several small files can still pass packaging if their sum exceeds 100KB.
Useful? React with 👍 / 👎.
| if [ ! -x "$VENV_NAME/bin/python" ]; then | ||
| [ -e "$VENV_NAME" ] && rm -rf "$VENV_NAME" | ||
| echo "==> Creating Python ${PYTHON_VERSION} virtual environment (${VENV_NAME})..." | ||
| uv venv "$VENV_NAME" --python "$PYTHON_VERSION" |
There was a problem hiding this comment.
Select an available Python instead of forcing 3.13
This installer always runs uv venv ... --python 3.13, even though Studio setup supports Python 3.11–3.13. On hosts that already have only 3.11/3.12 and cannot fetch managed interpreters (for example restricted networks or UV_PYTHON_DOWNLOADS=never), the install fails despite a compatible interpreter being present; the script should discover and use an installed compatible Python first.
Useful? React with 👍 / 👎.
* One liner setup for unsloth studio * Fix install scripts: system deps, activation bugs, curl/wget support - install.sh: detect platform (macOS/Linux/WSL) and check for missing system dependencies (cmake, git, build-essential, libcurl4-openssl-dev). Prompt user once for permission to install all missing packages via brew (macOS) or sudo apt-get (Linux/WSL). Add wget fallback via download() helper since curl is not always present on minimal Linux installs. Fix nested curl|sh stdin stealing by downloading uv installer to a tempfile first. Replace venv activation (no-op in a pipe subshell) with explicit --python flag for uv pip install and direct venv binary invocation. Add idempotency guard for venv creation. Redirect stdin on unsloth studio setup to prevent pipe consumption. On macOS, check for Xcode Command Line Tools and trigger install if missing. - install.ps1: wrap script body in Install-UnslothStudio function so that errors use return instead of exit (exit kills the terminal when run via irm|iex). Remove activate.ps1 invocation entirely -- use explicit --python path for uv pip install and & $UnslothExe for studio setup. This avoids both the child-scope activation bug (& vs dot-source) and the execution policy error on default Windows systems. Add winget availability check with clear error message. Fix PATH refresh to append registry paths instead of replacing the session PATH. Add uv installer fallback via astral.sh PowerShell script if winget install does not put uv on PATH. Broaden Python version check to accept 3.11-3.13. Add idempotency guard for venv creation. - README.md: add wget one-liner alternative for systems without curl. * Fix Tailwind CSS v4 .gitignore bug on Windows (unslothai#4444) - Add .gitignore hiding workaround to setup.ps1 (matching existing setup.sh logic) so venv .gitignore files containing "*" don't prevent Tailwind's oxide scanner from finding .tsx source files - Add CSS size validation to setup.sh, setup.ps1, and build.sh to catch truncated Tailwind builds early - Remove stray force-rebuild overrides that made the "skip build if current" cache check dead code in both setup scripts - Add rm -rf dist to build.sh to force clean rebuilds for wheel packaging * Change default port 8000 to 8888, fix installer bugs, improve UX - Change default Studio port from 8000 to 8888 across all entry points (run.py, studio.py, ui.py, colab.py, vite.config.ts, setup scripts) - Update launch banner: "Launching with studio venv..." to "Launching Unsloth Studio... Please wait..." - Add "Open your web browser" banner and rename labels (Local -> Local Access, External -> Worldwide Web Address) - Fix venv idempotency: check for bin/python instead of just directory existence, clean up partial venvs on retry - Fix build.sh CSS validation: handle empty CSS case that silently bypassed the check with "integer expression expected" - Fix install.sh sudo handling: try apt-get without sudo first (works when root), then escalate with per-package tracking and user prompt - Fix install.ps1: check exit code from studio setup, fail on error - Add pciutils to WSL GGUF build dependencies - Apply same smart apt-get escalation pattern to studio/setup.sh * Use detected Python version for venv, abort on non-apt Linux - install.ps1: detect existing Python 3.11/3.12/3.13 and use that version for venv creation instead of always forcing 3.13 - install.sh: exit with error on non-apt Linux distros when required packages cannot be auto-installed, instead of silently continuing * Make sudo permission prompt more prominent with warning banner * Add Accept [Y/n] sudo prompt to studio/setup.sh for consistency * Fix native command exit code handling and sudo decline flow install.ps1: Add $LASTEXITCODE checks after winget (Python), uv venv, and uv pip install calls. $ErrorActionPreference only catches PowerShell cmdlet errors, not native executable failures. The Python check also handles winget returning non-zero for "already installed". setup.sh: Skip llama-server build when user declines sudo or sudo is unavailable. Previously the script continued to section 8 which would fail with confusing errors (e.g. "gcc: command not found") since build-essential was never installed. * Move rm -rf llama.cpp inside build branch to preserve existing install When _SKIP_GGUF_BUILD is set (user declined sudo or sudo unavailable), the previous rm -rf would destroy an already-working llama-server before the skip check ran. Move it inside the else branch so existing builds are preserved when the rebuild is skipped. --------- Co-authored-by: Daniel Han <danielhanchen@users.noreply.github.com> Co-authored-by: Daniel Han <danielhanchen@gmail.com>
* One liner setup for unsloth studio * Fix install scripts: system deps, activation bugs, curl/wget support - install.sh: detect platform (macOS/Linux/WSL) and check for missing system dependencies (cmake, git, build-essential, libcurl4-openssl-dev). Prompt user once for permission to install all missing packages via brew (macOS) or sudo apt-get (Linux/WSL). Add wget fallback via download() helper since curl is not always present on minimal Linux installs. Fix nested curl|sh stdin stealing by downloading uv installer to a tempfile first. Replace venv activation (no-op in a pipe subshell) with explicit --python flag for uv pip install and direct venv binary invocation. Add idempotency guard for venv creation. Redirect stdin on unsloth studio setup to prevent pipe consumption. On macOS, check for Xcode Command Line Tools and trigger install if missing. - install.ps1: wrap script body in Install-UnslothStudio function so that errors use return instead of exit (exit kills the terminal when run via irm|iex). Remove activate.ps1 invocation entirely -- use explicit --python path for uv pip install and & $UnslothExe for studio setup. This avoids both the child-scope activation bug (& vs dot-source) and the execution policy error on default Windows systems. Add winget availability check with clear error message. Fix PATH refresh to append registry paths instead of replacing the session PATH. Add uv installer fallback via astral.sh PowerShell script if winget install does not put uv on PATH. Broaden Python version check to accept 3.11-3.13. Add idempotency guard for venv creation. - README.md: add wget one-liner alternative for systems without curl. * Fix Tailwind CSS v4 .gitignore bug on Windows (unslothai#4444) - Add .gitignore hiding workaround to setup.ps1 (matching existing setup.sh logic) so venv .gitignore files containing "*" don't prevent Tailwind's oxide scanner from finding .tsx source files - Add CSS size validation to setup.sh, setup.ps1, and build.sh to catch truncated Tailwind builds early - Remove stray force-rebuild overrides that made the "skip build if current" cache check dead code in both setup scripts - Add rm -rf dist to build.sh to force clean rebuilds for wheel packaging * Change default port 8000 to 8888, fix installer bugs, improve UX - Change default Studio port from 8000 to 8888 across all entry points (run.py, studio.py, ui.py, colab.py, vite.config.ts, setup scripts) - Update launch banner: "Launching with studio venv..." to "Launching Unsloth Studio... Please wait..." - Add "Open your web browser" banner and rename labels (Local -> Local Access, External -> Worldwide Web Address) - Fix venv idempotency: check for bin/python instead of just directory existence, clean up partial venvs on retry - Fix build.sh CSS validation: handle empty CSS case that silently bypassed the check with "integer expression expected" - Fix install.sh sudo handling: try apt-get without sudo first (works when root), then escalate with per-package tracking and user prompt - Fix install.ps1: check exit code from studio setup, fail on error - Add pciutils to WSL GGUF build dependencies - Apply same smart apt-get escalation pattern to studio/setup.sh * Use detected Python version for venv, abort on non-apt Linux - install.ps1: detect existing Python 3.11/3.12/3.13 and use that version for venv creation instead of always forcing 3.13 - install.sh: exit with error on non-apt Linux distros when required packages cannot be auto-installed, instead of silently continuing * Make sudo permission prompt more prominent with warning banner * Add Accept [Y/n] sudo prompt to studio/setup.sh for consistency * Fix native command exit code handling and sudo decline flow install.ps1: Add $LASTEXITCODE checks after winget (Python), uv venv, and uv pip install calls. $ErrorActionPreference only catches PowerShell cmdlet errors, not native executable failures. The Python check also handles winget returning non-zero for "already installed". setup.sh: Skip llama-server build when user declines sudo or sudo is unavailable. Previously the script continued to section 8 which would fail with confusing errors (e.g. "gcc: command not found") since build-essential was never installed. * Move rm -rf llama.cpp inside build branch to preserve existing install When _SKIP_GGUF_BUILD is set (user declined sudo or sudo unavailable), the previous rm -rf would destroy an already-working llama-server before the skip check ran. Move it inside the else branch so existing builds are preserved when the rebuild is skipped. --------- Co-authored-by: Daniel Han <danielhanchen@users.noreply.github.com> Co-authored-by: Daniel Han <danielhanchen@gmail.com>
Summary
Added two install scripts (install.sh for macOS/Linux/WSL and install.ps1 for Windows) that bundle the entire Unsloth Studio setup, installing uv, creating a Python 3.13 venv, installing unsloth, and running studio setup, into a single command (curl ... | sh or irm ... | iex), and updated the README to show these one-liners alongside the existing manual steps.