From 2e156691e2218d3831a831c2c9d601c545ce7bb3 Mon Sep 17 00:00:00 2001 From: Roland Tannous Date: Thu, 26 Mar 2026 14:31:43 +0000 Subject: [PATCH] Allow install_python_stack to run on Colab The _COLAB_NO_VENV flag was setting _SKIP_PYTHON_DEPS=true, which skipped both the PyPI version check (needs $VENV_DIR/bin/python) and install_python_stack (uses sys.executable, works without a venv). Introduce a separate _SKIP_VERSION_CHECK flag for the version check, so install_python_stack still runs on Colab. The _SKIP_PYTHON_DEPS flag remains available for the "versions match" fast path. --- studio/setup.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/studio/setup.sh b/studio/setup.sh index 4e46a12fe0..6f43446757 100755 --- a/studio/setup.sh +++ b/studio/setup.sh @@ -346,13 +346,15 @@ fi # ── Check if Python deps need updating ── # Compare installed package version against PyPI latest. # Skip all Python dependency work if versions match (fast update path). -# On Colab (no venv), skip the entire venv-dependent Python deps section. +# 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_VERSION_CHECK=false if [ "$_COLAB_NO_VENV" = true ]; then - _SKIP_PYTHON_DEPS=true + _SKIP_VERSION_CHECK=true fi _PKG_NAME="${STUDIO_PACKAGE_NAME:-unsloth}" -if [ "$_SKIP_PYTHON_DEPS" != true ] && [ "${SKIP_STUDIO_BASE:-0}" != "1" ] && [ "${STUDIO_LOCAL_INSTALL:-0}" != "1" ]; then +if [ "$_SKIP_VERSION_CHECK" != 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) INSTALLED_VER=$("$VENV_DIR/bin/python" -c " from importlib.metadata import version