Repository navigation
Studio: finish an update with the installer it installs - #11566
Conversation
|
@codex review |
1 similar comment
|
@codex review |
|
This is right and it should go in. It covers three causes I did not, and cause 1 explains the "worked after updating twice" reports directly: the running installer is the old one, so the update that installs the version carrying the Diffusers main step never runs that step. Cause 2 matches something I hit while testing #11565 and wrote off as out of scope. A plain and skips the whole pass, so an install left on 0.40.0 has no way back on its own. Your probe is the fix for that. Cause 3 is a good catch and worth calling out for how quiet it was: every pass was re-cloning and rebuilding a pinned commit that was already installed, and nothing in the output said so. One interaction to fix before both land. #11565 makes a host with no working git install the same pinned commit from if sys.version_info < DIFFUSERS_MAIN_MIN_PYTHON or not _has_working_git():
return FalseWith both changes in, that early return keeps the fast path on exactly the hosts that can now be repaired, and a git-less install stays on 0.40.0 forever with no update that forces the pass. It wants to be "no git AND no archive route" rather than "no git", which is one call to the helper #11565 adds. The Python floor stays as is. We also both touch Happy for this to go in first and I will rebase #11565 onto it. Two small things:
For reference, the #11565 side reproduced on the shipped bundles with |
* Let the stdout guard read writes, not flushes test_no_direct_stdout_writes flags sys.stdout.write and sys.stdout.flush outside the progress helpers, and has failed on main since unslothai#11566, which flushes stdout and stderr before rerunning the installer it just installed. That flush is needed: the child writes to the same descriptors, so anything still buffered would land after its output. A flush emits nothing and cannot glue text onto the progress bar, which is what the guard exists for. It now matches write only; a direct write on the same line still fails it. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Let the stdout guard read writes, not flushes test_no_direct_stdout_writes flags sys.stdout.write and sys.stdout.flush outside the progress helpers, and has failed on main since unslothai#11566, which flushes stdout and stderr before rerunning the installer it just installed. That flush is needed: the child writes to the same descriptors, so anything still buffered would land after its output. A flush emits nothing and cannot glue text onto the progress bar, which is what the guard exists for. It now matches write only; a direct write on the same line still fails it. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
unsloth studio updatefrom 2026.9.7 to 2026.9.8 leaves Diffusers at 0.40.0, so Qwen-Image-2.1 refuses to load with "needs diffusers >= 0.41.0 (QwenImage21Pipeline)". Running the update again does nothing: it reports "unsloth 2026.9.8 is up to date" and skips the dependency pass. Some users only got Qwen-Image-2.1 working after updating twice. The desktop app is affected the same way, because its in-app update runs the sameunsloth studio update.Cause
Three separate problems:
setup.sh/setup.ps1run the installedinstall_python_stack.py. Its core-packages step upgradesunsloth, which replaces that file on disk, but the running process keeps the old code and finishes the old step list. The 2026.9.7 installer has no pinned Diffusers main step (Add the Qwen-Image-2.1 family, and the Diffusers it needs by default #11405), so the update that installs 2026.9.8 skips it. The update log shows 17 steps, ending at "diffusers pin"; the 2026.9.8 installer has 18.unslothmatches PyPI,setup.sh/setup.ps1skip the dependency pass, and none of the fast-path escapes checks for the pinned Diffusers build. The install stays on the release until the next version bump.diffusers-main.txtandtriton-kernels.txtnamehttps://github.com/<org>/<repo>.git, while uv records the URL without.gitindirect_url.json._direct_reference_is_installedcompared the two after stripping only a trailing slash, so neither build ever matched. Every dependency pass reinstalled the Diffusers release, then re-cloned and rebuilt the pinned commit, and re-cloned triton_kernels.Fix
install_python_stack.pyreads its own source at startup. If the file differs after the core-packages step, it raises past the pass lock and reruns the new file in a subprocess, which finishes the pass.UNSLOTH_INSTALLER_RERUN=1on the rerun prevents a loop. A subprocess instead ofos.exec*, because on Windows exec returns tosetup.ps1while the child keeps running.install_python_stack.py --diffusers-main-needs-dependency-pass, called from the fast-path escapes in bothsetup.shandsetup.ps1. It exits 0 (force the pass) when the build is wanted but not installed, or whenUNSLOTH_DIFFUSERS_MAIN=0is set and the main build is still installed. It keeps the fast path when there is no git, on Python below 3.10, or when the last pass recorded a failed build. A failed build is now recorded asfailedinstead ofskipped, so a host that cannot reach github.com does not rerun the whole pass on every update. UnderUV_OFFLINE, the probe's answer is reported and the pass is left for the next online update, the same way the missing-torch escape handles it._vcs_url_keydrops a trailing/and.gitbefore comparing, so an installed pinned build is recognized and skipped.Before and after
Live updates, each in an isolated copy of a real Studio venv (CUDA, Linux), run through
unsloth studio updatewithUNSLOTH_TAURI_UPDATE=1.Existing install on 2026.9.8 with Diffusers 0.40.0, the state the 2026.9.7 to 2026.9.8 update left behind:
80c7ed26Upgrade between two locally built releases: the old one lacks the Diffusers main step, the new one has it.
80c7ed26Before the URL fix, the second update in the first table forced the pass again and rebuilt Diffusers even though the pinned build was installed.
Tests
tests/studio/install: 7526 passed, 1631 skipped. New cases cover the rerun decision and handoff, every probe branch (not installed, installed, no git, recorded failure, opt-out), and uv'sdirect_url.jsonURL shape.bash -n studio/setup.shpasses.Scope
setup.sh/setup.ps1(transformers sidecars, llama.cpp) is still the old script. Only the dependency pass reruns.setup.ps1change was not executed: no Windows host or PowerShell was available. The Windows installer's structural tests pass.