Studio install: deterministic pydantic install on no-torch path#5733
Studio install: deterministic pydantic install on no-torch path#5733danielhanchen wants to merge 1 commit into
Conversation
Real Windows CI failure, not a flake. Every PR's Studio Windows smoke jobs (Studio API + Auth, OpenAI Anthropic API, Chat UI, Tool calling, JSON images) fail at unsloth studio setup time with SystemError: The installed pydantic-core version (2.47.0) is incompatible with the current pydantic version, which requires 2.46.4. Root cause: no-torch-runtime.txt listed both pydantic and pydantic-core unpinned, then the installers (install.sh, install.ps1, install_python_stack.py update path) ran uv pip install --no-deps -r no-torch-runtime.txt so pip resolved each independently and picked pydantic 2.13.4 (latest, requires pydantic-core==2.46.4) pydantic-core 2.47.0 (latest, mismatched) pydantic's _ensure_pydantic_core_version check then fails on the first import. Linux and Mac runners often happen to have a matching pair cached from a prior unrelated install, so the trip only fires reliably on a fresh Windows venv. Fix: install pydantic WITH deps before the --no-deps no-torch runtime install in every no-torch entry point (two paths each in install.sh and install.ps1, plus install_python_stack.py update path). pip then pins pydantic-core to the exact version pydantic declares, and the next import works. pydantic's transitive deps (annotated-types, pydantic-core, typing-extensions, typing-inspection) are all torch-free so this is safe for the no-torch contract. Drop the now-redundant pydantic / pydantic-core / annotated-types / typing-inspection entries from no-torch-runtime.txt with a header comment explaining the split.
There was a problem hiding this comment.
Code Review
This pull request updates the installation scripts (install.ps1, install.sh, and install_python_stack.py) and the no-torch-runtime.txt requirements file to ensure pydantic is installed with its dependencies. This change addresses a version mismatch issue between pydantic and pydantic-core that occurs during --no-deps installations, which previously caused SystemError or ModuleNotFoundError during imports. By installing pydantic separately with dependencies, the installer ensures that compatible versions of its core components are pinned correctly. I have no feedback to provide as there were no review comments.
PR 5733 fixes the root cause: install.sh / install.ps1 / install_python_stack.py now do a separate `pip install pydantic` (with deps) before the --no-deps no-torch-runtime install, so pip resolves pydantic-core to the exact version pydantic's metadata requires. The Studio venv is consistent on first import. The four Windows smoke YAMLs carried a 'Patch Studio venv with full typer / pydantic dep trees' step that ran AFTER the installer to re-install typer + pydantic + huggingface_hub with deps as a belt-and-suspenders workaround. Six occurrences across the four files. With 5733 landed the workaround is dead weight; remove it. Depends on #5733.
Bundles three independent CI regressions hitting the maintainer PR backlog. Each one is verified end-to-end on a staging fork against real Ubuntu / macOS / Windows GitHub-hosted runners before this lands. 1. Windows --no-torch install: pydantic + pydantic-core drift to incompatible versions under `uv pip install --no-deps -r no-torch-runtime.txt` because pip resolves each independently from latest. pydantic.VERSION 2.13.4 pins pydantic-core==2.46.4 but pydantic-core 2.47.0 was the freshest published wheel, so `import pydantic` raised `SystemError: pydantic-core 2.47.0 is incompatible with the current pydantic version`. Resolve pydantic WITH deps in a focused pip call (install.sh, install.ps1, install_python_stack.py) before the --no-deps no-torch-runtime pass so pip pins pydantic-core to the version pydantic declares. pydantic's transitive deps (annotated-types, pydantic-core, typing-extensions, typing-inspection) are torch-free. Drop the redundant `Patch Studio venv with full typer / pydantic dep trees` workaround from the four Windows smoke YAMLs. Supersedes #5733 + #5734. 2. Linux Studio Update CI: upstream llama.cpp b9261+ split each binary's entry code into a paired `libllama-<binary>-impl.so` shared library. `llama-server` and `llama-quantize` NEEDED-link against `libllama-server-impl.so` / `libllama-quantize-impl.so` with RUNPATH `$ORIGIN`, so the prebuilt overlay must copy those alongside the binaries. Without that, ldd reports them missing, preflight rejects, the installer falls back to source build, and studio-update-smoke annotates `setup.sh idempotency regressed`. Add `libllama-*-impl.so*` to the Linux runtime patterns and lock the pattern in test_rocm_support.TestRuntimePatterns. 3. Mac Studio UI Chat: change-password submit clicked while disabled. The disable gate only checked new + confirm password length, but Playwright's first click landed before the current-password field's React state had committed, so the form was simultaneously logically-invalid (current_password empty) and the button was disabled. Tighten the gate to require `currentPassword.length >= 8` and mirror the same check in the submit handler so Enter / autofill cannot bypass. Supersedes #5738.
|
Superseded by #5741 (now merged). The pydantic-core mismatch, llama.cpp |
Bundles three independent CI regressions hitting the maintainer PR backlog. Each one is verified end-to-end on a staging fork against real Ubuntu / macOS / Windows GitHub-hosted runners before this lands. 1. Windows --no-torch install: pydantic + pydantic-core drift to incompatible versions under `uv pip install --no-deps -r no-torch-runtime.txt` because pip resolves each independently from latest. pydantic.VERSION 2.13.4 pins pydantic-core==2.46.4 but pydantic-core 2.47.0 was the freshest published wheel, so `import pydantic` raised `SystemError: pydantic-core 2.47.0 is incompatible with the current pydantic version`. Resolve pydantic WITH deps in a focused pip call (install.sh, install.ps1, install_python_stack.py) before the --no-deps no-torch-runtime pass so pip pins pydantic-core to the version pydantic declares. pydantic's transitive deps (annotated-types, pydantic-core, typing-extensions, typing-inspection) are torch-free. Drop the redundant `Patch Studio venv with full typer / pydantic dep trees` workaround from the four Windows smoke YAMLs. Supersedes unslothai#5733 + unslothai#5734. 2. Linux Studio Update CI: upstream llama.cpp b9261+ split each binary's entry code into a paired `libllama-<binary>-impl.so` shared library. `llama-server` and `llama-quantize` NEEDED-link against `libllama-server-impl.so` / `libllama-quantize-impl.so` with RUNPATH `$ORIGIN`, so the prebuilt overlay must copy those alongside the binaries. Without that, ldd reports them missing, preflight rejects, the installer falls back to source build, and studio-update-smoke annotates `setup.sh idempotency regressed`. Add `libllama-*-impl.so*` to the Linux runtime patterns and lock the pattern in test_rocm_support.TestRuntimePatterns. 3. Mac Studio UI Chat: change-password submit clicked while disabled. The disable gate only checked new + confirm password length, but Playwright's first click landed before the current-password field's React state had committed, so the form was simultaneously logically-invalid (current_password empty) and the button was disabled. Tighten the gate to require `currentPassword.length >= 8` and mirror the same check in the submit handler so Enter / autofill cannot bypass. Supersedes unslothai#5738.
Summary
Real Windows CI failure across every authored PR, not a flake. Every Studio Windows smoke job (Studio API + Auth, OpenAI Anthropic API, Chat UI, Tool calling, JSON images) fails at
unsloth studio setuptime withRoot cause
studio/backend/requirements/no-torch-runtime.txtlistspydanticandpydantic-coreunpinned. Every installer entry point (install.sh, install.ps1, install_python_stack.py update path) then runsso pip resolves each independently and picks
pydantic 2.13.4(latest, requirespydantic-core==2.46.4)pydantic-core 2.47.0(latest, mismatched)pydantic's
_ensure_pydantic_core_versioncheck then fails on the next import. Linux and Mac runners frequently have a matching pair cached from a prior unrelated install, so the trip only fires reliably on a fresh Windows venv.Fix
Install
pydanticWITH deps before the--no-depsno-torch runtime install in every no-torch entry point (two paths each in install.sh and install.ps1, plus the update path in install_python_stack.py). pip then pinspydantic-coreto the exact versionpydanticdeclares, and the next import works. pydantic's transitive deps (annotated-types,pydantic-core,typing-extensions,typing-inspection) are all torch-free so the no-torch contract still holds.Dropped the now-redundant
pydantic/pydantic-core/annotated-types/typing-inspectionentries fromno-torch-runtime.txtwith a header comment explaining the split.Test plan
Patch Studio venv with full typer / pydantic dep treesworkaround step in studio-windows-*-smoke.yml is now redundant (followup, needs workflow scope)