Repository navigation
Description
install.sh treats a failed PATH-append to the shell profile as an install failure, firing the venv rollback trap after the success banner has already printed.
Environment
Where are you using Unsloth?
- Studio desktop application
- Studio web UI (
unsloth studio) - Unsloth CLI
- Python package or notebook
- Colab or Kaggle
Installed with the developer/source flow: ./install.sh --local.
Operating system and version:
NixOS 25.11 (kernel 6.12.93), zsh
GPU model(s) and accelerator backend:
NVIDIA GeForce RTX 4070 Laptop GPU, CUDA 13.0, driver 580.142
Versions:
- Unsloth 2026.8.18 (repo commit
6e5360ca9) - Python 3.13.12 (installer-created venv)
- torch 2.11.0+cu130
What happened?
Steps to reproduce:
- Make the user's shell profile non-writable. In my case
~/.zshrcis owned byroot:rootwith mode644; any managed, immutable, or root-owned dotfile setup reproduces it. - Run
./install.sh --local. - Read the last few lines of output, after the
Unsloth Studio Installedbanner.
Expected behavior:
Failing to append to the shell profile is cosmetic — it affects PATH convenience only. The installer should warn, tell the user to add the bin directory to PATH themselves, and exit successfully without touching the environment it just built.
Actual behavior:
The failed write trips the EXIT trap that performs the venv rollback, so the installer announces a failed install after it has already announced success:
────────────────────────────────────────────────────
Unsloth Studio Installed
────────────────────────────────────────────────────
launch unsloth studio -p 8888
./install.sh: line 5537: /home/<user>/.zshrc: Permission denied
restoring previous environment after failed install...
restored previous environment
The install itself is fine — the process still exits 0, and afterwards unsloth --version, import unsloth, and torch.cuda.is_available() all work. So the visible symptom is a misleading message, but the underlying behaviour is that a just-built venv is rolled back over on the basis of an unrelated, non-fatal error. On a run where the rollback copy and the new venv genuinely differ, that looks like it could discard real work.
Reproduced on two separate runs of ./install.sh --local.
Model and operation involved:
Installation only. No model involved.
Diagnostics and logs
Relevant excerpt from the terminal output of ./install.sh --local (full log omitted; it is ~1400 lines and contains local paths):
whisper.cpp prebuilt installed
────────────────────────────────────────────────────
Unsloth Studio Installed
────────────────────────────────────────────────────
launch unsloth studio -p 8888
(add -H 0.0.0.0 for LAN / cloud access; exposes the raw port only, not a public URL)
./install.sh: line 5537: /home/<user>/.zshrc: Permission denied
restoring previous environment after failed install...
restored previous environment
Verification that the install is actually healthy despite the rollback message:
unsloth 2026.8.18
torch 2.11.0+cu130 | cuda True | NVIDIA GeForce RTX 4070 Laptop GPU
import unsloth -> OK
no leftover unsloth_studio.rollback.* directories
Additional context
The write is at install.sh:5537. The rollback machinery is
_restore_studio_venv_replacement / _VENV_ROLLBACK_ACTIVE, installed as an
EXIT/signal trap earlier in the script.
Suggested fix: guard the profile write so a failure cannot reach the rollback
trap — e.g. ... >> "$profile" 2>/dev/null || warn "could not add <bindir> to PATH; add it manually" — or clear the rollback trap once the install has been
committed and the success banner printed.
Not NixOS-specific: any environment with a non-writable shell profile hits this,
including managed corporate machines, immutable distributions, container images,
and root-owned dotfiles.
Activity