Compare commits

...
Sign in to create a new pull request.

4 commits

Author SHA1 Message Date
Roland Tannous
83309560a9 Allow install_python_stack to run on Colab
The _COLAB_NO_VENV flag was skipping both the PyPI version check
(which needs $VENV_DIR/bin/python) and install_python_stack (which
uses sys.executable and works fine without a venv). Decouple these:
guard only the version check with _COLAB_NO_VENV, so
install_python_stack runs normally on Colab.
2026-03-26 14:31:43 +00:00
Roland Tannous
f5c33c1594 Add --local flag to setup.sh in Colab notebook 2026-03-26 09:44:34 +00:00
Roland Tannous
95dc2c0de5 Simplify _SKIP_PYTHON_DEPS initialization 2026-03-26 09:30:01 +00:00
Roland Tannous
c816455615 Fix Colab setup skipping llama.cpp installation
The early exit 0 in the Colab no-venv path prevented setup.sh from
ever reaching the llama.cpp install section. Remove the early exit
and instead guard only the venv-dependent Python deps section, so
execution continues through to the llama.cpp prebuilt/source install.
2026-03-26 08:52:38 +00:00
2 changed files with 156 additions and 170 deletions

View file

@ -64,11 +64,7 @@
"id": "27e68f91" "id": "27e68f91"
}, },
"outputs": [], "outputs": [],
"source": [ "source": "!git clone --depth 1 --branch main https://github.com/unslothai/unsloth.git\n%cd /content/unsloth\n!chmod +x studio/setup.sh && ./studio/setup.sh --local"
"!git clone --depth 1 --branch main https://github.com/unslothai/unsloth.git\n",
"%cd /content/unsloth\n",
"!chmod +x studio/setup.sh && ./studio/setup.sh"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",

View file

@ -337,30 +337,20 @@ fast_install() {
cd "$SCRIPT_DIR" cd "$SCRIPT_DIR"
# On Colab without a venv, skip all venv-dependent sections (Python deps # On Colab without a venv, skip venv-dependent Python deps sections but
# update, llama.cpp build) -- the backend deps were already installed above. # continue to llama.cpp install so GGUF inference is available.
if [ "$_COLAB_NO_VENV" = true ]; then if [ "$_COLAB_NO_VENV" = true ]; then
echo "✅ Studio backend dependencies installed into system Python" echo "✅ Studio backend dependencies installed into system Python"
echo ""
echo "╔══════════════════════════════════════╗"
echo "║ Setup Complete! ║"
echo "╠══════════════════════════════════════╣"
echo "║ Unsloth Studio is ready to start ║"
echo "║ in your Colab notebook! ║"
echo "║ ║"
echo "║ from colab import start ║"
echo "║ start() ║"
echo "╚══════════════════════════════════════╝"
exit 0
fi fi
# ── Check if Python deps need updating ── # ── Check if Python deps need updating ──
# Compare installed package version against PyPI latest. # Compare installed package version against PyPI latest.
# Skip all Python dependency work if versions match (fast update path). # Skip all Python dependency work if versions match (fast update path).
_PKG_NAME="${STUDIO_PACKAGE_NAME:-unsloth}" # On Colab (no venv), skip this version check (it needs $VENV_DIR/bin/python)
# but still run install_python_stack below (it uses sys.executable).
_SKIP_PYTHON_DEPS=false _SKIP_PYTHON_DEPS=false
if [ "${SKIP_STUDIO_BASE:-0}" != "1" ] && [ "${STUDIO_LOCAL_INSTALL:-0}" != "1" ]; then _PKG_NAME="${STUDIO_PACKAGE_NAME:-unsloth}"
if [ "$_COLAB_NO_VENV" != true ] && [ "${SKIP_STUDIO_BASE:-0}" != "1" ] && [ "${STUDIO_LOCAL_INSTALL:-0}" != "1" ]; then
# Only check when NOT called from install.sh (which just installed the package) # Only check when NOT called from install.sh (which just installed the package)
INSTALLED_VER=$("$VENV_DIR/bin/python" -c " INSTALLED_VER=$("$VENV_DIR/bin/python" -c "
from importlib.metadata import version from importlib.metadata import version