Notebooks smoke: run the install cell the way Colab does (#14058)
Some checks failed
CodeQL / Languages to analyse (push) Waiting to run
CodeQL / Analyze () (push) Blocked by required conditions
CodeQL / Prune superseded CodeQL overlay bases (push) Blocked by required conditions
Core / Resolve the unsloth_zoo revision (push) Waiting to run
Core / Core (HF=default + TRL=default) (push) Blocked by required conditions
Core / Core (HF=4.57.6 + TRL<1) (push) Blocked by required conditions
Core / Core (HF=latest + TRL=latest) (push) Blocked by required conditions
Core / Core zoo (HF=default + TRL=default) (push) Blocked by required conditions
Core / Core zoo (HF=4.57.6 + TRL<1) (push) Blocked by required conditions
Core / Core zoo (HF=latest + TRL=latest) (push) Blocked by required conditions
Core / llama.cpp build + smoke (push) Waiting to run
Kaggle T4 Unsloth GPU CI / gate (push) Waiting to run
Kaggle T4 Unsloth GPU CI / Unsloth GPU smoke (push) Blocked by required conditions
Lint CI / Source lint (Python + shell + YAML + JSON + safety nets) (push) Waiting to run
Local Agent Guides CI / connection (claude, stable) (push) Waiting to run
Local Agent Guides CI / connection (codex, stable) (push) Waiting to run
Local Agent Guides CI / connection (dsh, stable) (push) Waiting to run
Local Agent Guides CI / connection (hermes, stable) (push) Waiting to run
Local Agent Guides CI / connection (openclaw, stable) (push) Waiting to run
Local Agent Guides CI / connection (opencode, stable) (push) Waiting to run
Local Agent Guides CI / connection (opencode, v2) (push) Waiting to run
Local Agent Guides CI / connection (pi, stable) (push) Waiting to run
Local Agent Guides CI / connection (vibe, stable) (push) Waiting to run
Local Agent Guides CI / file-edit (claude) (push) Waiting to run
Local Agent Guides CI / file-edit (codex) (push) Waiting to run
Local Agent Guides CI / file-edit (dsh) (push) Waiting to run
Local Agent Guides CI / file-edit (hermes) (push) Waiting to run
Local Agent Guides CI / file-edit (openclaw) (push) Waiting to run
Local Agent Guides CI / file-edit (opencode) (push) Waiting to run
Local Agent Guides CI / file-edit (pi) (push) Waiting to run
Local Agent Guides CI / file-edit (vibe) (push) Waiting to run
Local Agent Guides CI / resume (claude) (push) Waiting to run
Local Agent Guides CI / resume (codex) (push) Waiting to run
Local Agent Guides CI / resume (opencode) (push) Waiting to run
Local Agent Guides CI / resume (pi) (push) Waiting to run
Local Agent Guides CI / prompt-cache (gemma-3-270m) (push) Waiting to run
Security audit / advisory audit (pip + npm + cargo) (push) Waiting to run
Security audit / pip scan-packages :: audio-torch280 (push) Waiting to run
Security audit / pip scan-packages :: audio-torch290 (push) Waiting to run
Security audit / pip scan-packages :: extras (push) Waiting to run
Security audit / pip scan-packages :: studio (push) Waiting to run
Security audit / pip scan-packages :: hf-stack (push) Waiting to run
Security audit / npm scan-packages (Unsloth frontend tarballs) (push) Waiting to run
Security audit / npm provenance + new install-script diff (push) Waiting to run
Unsloth API CI / Unsloth API & Auth Tests (push) Waiting to run
Backend CI / (Python 3.11, floor) (push) Waiting to run
Backend CI / (Python 3.13, a-k) (push) Waiting to run
Backend CI / (Python 3.13, l-r) (push) Waiting to run
Backend CI / (Python 3.13, rest) (push) Waiting to run
Backend CI / Repo tests (CPU, rest) (push) Waiting to run
Backend CI / Repo tests (CPU, studio) (push) Waiting to run
Backend CI / Repo tests (CPU, studio-install) (push) Waiting to run
Backend CI / Shell installer tests (push) Waiting to run
Frontend CI / Frontend build + bundle sanity (push) Waiting to run
Frontend CI / Frontend unit tests (Windows) (push) Waiting to run
Unsloth GGUF CI / GGUF inference smoke (API, tools, vision) (push) Waiting to run
Mac Unsloth UI + API + Update + Inference CI / Chat UI, API, Update and GGUF inference (push) Waiting to run
Unsloth Tauri CI / Tauri Linux debug build (no codesign) (push) Waiting to run
Unsloth Tauri CI / Rust unit tests (windows) (push) Waiting to run
Unsloth Tauri CI / Rust unit tests (macos) (push) Waiting to run
Unsloth UI CI / Chat UI Tests (extra) (push) Waiting to run
Unsloth UI CI / Chat UI Tests (chat) (push) Waiting to run
Unsloth UI CI / Loaded-models indicator (cross-browser) (push) Waiting to run
Studio VAE seam guard / seam-guard (push) Waiting to run
Windows Unsloth API CI / Unsloth API & Auth Tests (push) Waiting to run
Windows Unsloth GGUF CI / GGUF inference smoke (API, tools, vision) (push) Waiting to run
Windows Unsloth GGUF CI / Unsloth install + inference without Visual Studio (push) Waiting to run
Windows Unsloth GGUF CI / real-VS detection (VS 2022) (push) Waiting to run
Windows Unsloth GGUF CI / real-VS detection + VC++ round-trip (VS 2026) (push) Waiting to run
Windows Unsloth GGUF CI / setup.ps1 units, no-VS resolve, VC++ round-trip (windows-latest) (push) Waiting to run
Windows Unsloth UI CI / Chat UI Tests (push) Waiting to run
Windows Unsloth Update CI / Unsloth Updating Tests (push) Waiting to run
studiobench CI / Selftests, lint and the single-file build (push) Waiting to run
studiobench CI / Real-path session, every action ran (push) Waiting to run
Wheel CI / Wheel build + content sanity + import smoke (push) Waiting to run
Workflow trigger lint / workflow-trigger lint (pull_request_target / cache-poisoning) (push) Waiting to run
Workflow trigger lint / security suites (torch-dependent) (push) Waiting to run
Cross-platform parity / parity (ubuntu-latest) (push) Has been cancelled
Cross-platform parity / parity (windows-latest) (push) Has been cancelled
Kaggle T4 Notebook CI / gate (push) Has been cancelled
MLX CI on Mac M1 / dispatch (push) Has been cancelled
Unsloth export capability / capability (windows-latest) (push) Has been cancelled
Mac Unsloth Install Matrix CI / Install + load (macos-15) (push) Has been cancelled
Mac Unsloth Install Matrix CI / Install + load (macos-26) (push) Has been cancelled
Mac Unsloth Install Matrix CI / Install + load (macos-15-intel) (push) Has been cancelled
Mac Unsloth Install Matrix CI / Install + load (macos-26-intel) (push) Has been cancelled
Unsloth Update CI / Unsloth Updating Tests (push) Has been cancelled
Unsloth Update CI / Unsloth Updating Tests (macOS) (push) Has been cancelled
Unsloth Update CI / Unsloth Updating Tests (Windows) (push) Has been cancelled
Windows Application Control CI / installer survives a denied unsloth.exe (push) Has been cancelled
Windows ARM64 CI / woa (pwsh-7) (push) Has been cancelled
Windows ARM64 CI / woa (windows-powershell-5.1) (push) Has been cancelled
Windows No Compiler CI / the installer spawns no C# compiler (push) Has been cancelled
Interrupted install recovery / select legs (push) Has been cancelled
Kaggle T4 Notebook CI / T4 smoke (push) Has been cancelled
Interrupted install recovery / kill@ (push) Has been cancelled
Interrupted install recovery / windows kill@ (push) Has been cancelled

## Summary

Two install-cell smoke legs fail on main's scheduled `Notebooks CI`
(2026-10-17 06:39, run 39010742438):
- `nb/Nemotron-3-Nano-30B-A3B_A100.ipynb`
- `nb/Qwen3_5_(4B)_Vision.ipynb`

Both fail like this:

```
error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
FileNotFoundError: [Errno 2] No such file or directory: 'unsloth'
```

Their install cells use `!uv pip install`, and the next line is
`!unsloth install-kernels` (unslothai/notebooks #385). On Colab the uv
lines work because Colab sets `UV_SYSTEM_PYTHON=true`. I checked this on
a live `release-colab-external-images_20261014` runtime, along with its
`COLAB_*` keys. The smoke job installs into the runner's system
interpreter as a stand-in for Colab's, but its install step set neither:
- uv refused to run.
- The notebooks also took their non-Colab branch, since they choose the
branch on any environment key containing `COLAB_`.

Setting only `UV_SYSTEM_PYTHON` is not enough, which I tried first while
working on #14056. The non-Colab branch then left `transformers==4.57.6`
(installed `--no-deps`) beside `huggingface_hub` 1.29, which it refuses
to import with, and the gpt-oss leg lost `triton`. Colab's own branch
reinstalls with dependencies, so the job has to take that branch to test
what Colab users run.

## Change

- **`notebooks-ci.yml`:** the `Run install cell` step sets
`UV_SYSTEM_PYTHON: 'true'` and a `COLAB_SMOKE_SHAPED: '1'` marker, with
a comment explaining why.
- The marker is scoped to that one step, which stops before `from
unsloth import`.
- Its name matches none of the specific `COLAB_*` keys Unsloth reads
(`COLAB_ENVIRONMENT`, `COLAB_IFRAME_HEIGHT`, ...).
  - `disk_utils`' generic `COLAB_` scan never runs inside that step.
- **`tests/notebooks/test_smoke_install_contract.py`:**
`test_the_install_cell_runs_the_way_colab_does` requires a `COLAB_*` key
and `UV_SYSTEM_PYTHON` on every step that runs the converted install
cell.

## Testing

- **`Notebooks CI` with `include_smoke=true` on this branch (run
39017258647):** all eight smoke legs pass, including Nemotron-3-Nano and
Qwen3_5 Vision, which fail on main. GRPO and gpt-oss also still pass.
- **The Nemotron leg did real work rather than skipping:**
  - It printed no `No virtual environment found`.
  - uv installed and uninstalled packages.
- `unsloth install-kernels` ran and chose its torch fallback for
causal_conv1d and mamba_ssm on CPU torch.
  - `OK: imports pass under CUDA spoof`.
- **Contract test:** `test_smoke_install_contract.py` gives 39 passed.
With the workflow change reverted, the new test fails.

The `static + transitive resolve` job is still red in that run. That is
the Colab oracle snapshot drift that has failed on every scheduled run
since at least 2026-09-27, and it is unrelated to this change.
This commit is contained in:
Daniel Han 2026-10-17 01:40:50 -07:00 • committed by GitHub
parent e0dc2843d7
commit e795149d99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 33 additions and 0 deletions

View file

@ -729,6 +729,15 @@ jobs:
timeout-minutes: 10
env:
NOTEBOOK: ${{ matrix.notebook }}
# Run the install cell the way Colab does (checked on a live
# release-colab-external-images_20261014 runtime). The notebooks pick their
# Colab branch on any environment key containing "COLAB_", and Colab sets
# UV_SYSTEM_PYTHON so their `!uv pip install` lines target the system
# interpreter. Without both, the cell takes the non-Colab branch and uv stops
# with "No virtual environment found". The marker's name matches none of the
# COLAB_* keys Unsloth itself reads.
COLAB_SMOKE_SHAPED: '1'
UV_SYSTEM_PYTHON: 'true'
run: |
set -euo pipefail
# Convert THIS notebook only, and take whatever file the converter

View file

@ -564,3 +564,27 @@ def test_loading_the_stub_helper_leaves_sys_path_alone():
needle = "sys.path" + ".insert(0, str(REPO / " + chr(34) + "tests" + chr(34) + "))"
source = Path(__file__).read_text(encoding = "utf-8")
assert needle not in source, "a sys.path insert of the tests dir is back in this file"
def test_the_install_cell_runs_the_way_colab_does():
"""The install cell sees what Colab gives it: a COLAB_* key and UV_SYSTEM_PYTHON.
The notebooks take their Colab branch on any environment key containing "COLAB_", and their
`!uv pip install` lines need UV_SYSTEM_PYTHON (Colab sets it) to install into the system
interpreter. With neither, Nemotron-3-Nano and Qwen3_5 Vision took the non-Colab branch, uv
stopped with "No virtual environment found", and `!unsloth install-kernels` failed as a missing
command (2026-10-17 cron). With only UV_SYSTEM_PYTHON, the non-Colab branch left
transformers 4.57.6 beside huggingface_hub 1.x and gpt-oss lost triton.
"""
steps = [step for step in _job()["steps"] if "_smoke.py" in str(step.get("run", ""))]
assert steps, "no step runs the converted install cell any more; update this guard"
for step in steps:
env = {**(_job().get("env") or {}), **(step.get("env") or {})}
name = step.get("name")
assert any(
"COLAB_" in key for key in env
), f"step {name!r} runs the install cell without a COLAB_* key"
assert str(env.get("UV_SYSTEM_PYTHON", "")).lower() in (
"1",
"true",
), f"step {name!r} runs the install cell without UV_SYSTEM_PYTHON, which Colab sets"