Skip to content

Windows on ARM: stop reusing an ARM64 interpreter, and add an inference-only tier - #8599

Closed
danielhanchen wants to merge 57 commits into
mainfrom
windows-arm64-python-arch
Closed

danielhanchen wants to merge 57 commits into
mainfrom
windows-arm64-python-arch

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Fixes #8495.

Unsloth Desktop and Studio fail on a Snapdragon X2 Elite with Installation failed: install unsloth failed (exit code 1): pyarrow.

Why

pyarrow has never published a win_arm64 wheel at any version, and datasets==4.3.0 requires pyarrow>=21, so on a native ARM64 interpreter uv falls through to an Arrow C++ source build and dies. install.ps1 has swapped a freshly selected interpreter for an x64 one since #7549, and on a clean machine that still works. Every path that reuses an interpreter checked version and conda-ness only:

Path What it validated
install.ps1:2963-3005 migrated venvs (legacy .venv, CWD-relative) reused with no arch probe; Test-VenvPythonReady only runs sys.exit(0)
setup.ps1:3223-3243, :3274-3284, :3651-3661 version + conda only; UNSLOTH_SETUP_PYTHON accepted on a bare Test-Path
setup.ps1:3329-3347 winget fallback with no --architecture x64, so it installs the ARM64 package
install_python_stack.py no preflight at all

So a machine with an ARM64 venv from an earlier run, or one where the x64 bootstrap could not complete, still reached the pyarrow build.

The Linux half is a separate bug in the same message: install.sh never range-checked --python / UNSLOTH_PYTHON, so an unsupported minor went straight to uv venv and surfaced minutes later as a bare dependency name. On 3.9 that name is pyarrow (constraints.txt pins pyarrow==23.0.1, which has no cp39 wheel on any platform), and matplotlib, pymupdf, pymupdf4llm and fastmcp are 3.10+ as well.

What changed

Architecture is now checked wherever an interpreter is chosen or reused

  • install.ps1: bootstraps x64 by default on an ARM64 host rather than installing an ARM64 CPython it must immediately replace; re-probes a migrated venv with the existing Get-PythonPlatformTag and rebuilds it through Start-StudioVenvRollback when it is not win-amd64.
  • setup.ps1: one Test-CompatibleSetupPythonArch predicate applied to all five interpreter paths, a clear failure for an ARM64 environment naming the fix instead of the symptom, and --architecture x64 on the winget fallback.
  • install_python_stack.py: preflight before the manifest is dropped, so nothing is mutated on the paths that reach the installer directly.
  • install.sh: rejects a Python the stack cannot install on. Below 3.10 is a hard error naming the packages; 3.10 still resolves the whole set today so it stays allowed even though the Windows floor is 3.11; above 3.13 warns and continues, since unproven is not the same as known broken.

Every check reads sysconfig.get_platform(), never the host arch: the supported Windows on ARM configuration is an emulated x64 CPython, where the host is arm64 and the answer that matters is win-amd64.

ARM64 inference-only tier, when x64 cannot be obtained

Warning and then failing inside a CMake build is worse than saying so up front, but refusing outright leaves a Snapdragon with nothing. datasets turns out to be almost entirely lazy: the module-level import graph reachable from main.py, run.py and routes/ contains neither datasets nor pyarrow, and the only module-scope from datasets import Dataset (core/training/trainer.py:59) loads inside the spawned training worker. So chat, model downloads and the Images/Video pages work without it. Training does not, on any platform.

The tier generalises the existing --no-torch machinery rather than adding a parallel one: a .unsloth-no-datasets marker plus manifest key (so unsloth studio update stays in tier), a skip set for packages with no win_arm64 wheel at any version, and single-env/overrides-win-arm64.txt for pins that predate theirs. It is entered automatically when Install-X64Python fails, or up front with UNSLOTH_NO_DATASETS=1 for someone who would rather keep a native ARM64 environment than run x64 emulated.

Dropped (no win_arm64 wheel at any version, each already degrades at runtime): datasets, trl (requires datasets), sqlite-vec (RAG already sets RAG_AVAILABLE = False without it), tiktoken, hf-transfer (the hub paths already force it off), ddgs (pulls brotli), pandas (only the 3.0 line has wheels and studio.txt pins 2.3.3 deliberately), pytorch-tokenizers, torch-c-dlpack-ext, MeCab, tensorboard (pulls grpcio, whose BoringSSL ASM has no ARM64 Windows target).

Lifted: pymupdf>=1.28.2, av>=17.0.0, scikit-learn>=1.8.0.

Runtime degradation instead of a 500

utils/datasets_availability.py mirrors storage/rag_db.py: a module flag, a RuntimeError subclass, and a FastAPI dependency returning 503 with a stated reason. It never imports datasets, only find_spec. Gated: the whole hub datasets router, and the two training start endpoints. /status, /progress and /metrics stay reachable so a UI already polling keeps working. /api/health reports chat_only with reason datasets_unavailable, which the sidebar already knows how to explain.

Testing

Verified on a real Windows ARM64 host (windows-11-arm runner), not simulated:

  • sysconfig.get_platform() reports win-arm64 and pyarrow==23.0.1 is unresolvable; the wheel gaps in studio.txt are pandas, datasets, sqlite-vec, pymupdf. The same set resolves for x64.
  • Before the change, Get-CompatiblePythonVersion accepted a win-arm64 interpreter for reuse (reuse gate verdict = 3.13.14). After it, the same runner reports the interpreter rejected for a full install and accepted for the tier.
  • A clean install.ps1 run swaps to x64 and produces a win-amd64 venv.
  • ubuntu-24.04-arm: every studio requirement resolves and install.sh completes, so aarch64 Linux keeps installing natively and is untouched by any of this.
  • ubuntu-latest: pyarrow==23.0.1 has no cp39 wheel, and matplotlib, fastmcp, pymupdf, pymupdf4llm are 3.10+ too.

Suites: tests/python is 1061 passed against 1047 on main, with the same three pre-existing failures on both (a network dependent tokenizers e2e, the no-torch sandbox, and an ordering dependent RL pickling test that passes in isolation on either branch). All 47 tests/sh scripts pass. 20 new backend tests, plus new cases in test_windows_arm64_python_choice.py, test_cross_platform_parity.py, test_install_python_stack.py and test_install_python_guard.sh. The PowerShell and Python skip and lift sets are held together by parity tests, since they are two implementations of one rule.

The end to end tier install on windows-11-arm is still being driven to green on a staging fork. It has already found four real bugs that unit tests could not: install.ps1 handing uv an unfiltered requirements file, constraint ceilings that an override cannot lift (only remove), UV_OVERRIDE reaching neither a --no-deps install nor the pip fallback, and _filter_requirements comparing raw text so pytorch_tokenizers never matched pytorch-tokenizers. All four are fixed here. I will report the final run on this PR.

Compatibility

Behaviour changes only when Get-HostMachineArch is arm64 on Windows, or when an out of range --python is requested. x64 Windows, Linux x86_64 and aarch64, WSL, and macOS on both Intel and Apple Silicon keep their exact current code paths. The tier is inert without the marker or the env var, so existing installs read DATASETS_AVAILABLE = True and see no change. No trainer, kernel or torch.compile surface is touched.

…ce-only tier

pyarrow ships no win_arm64 wheel at any version and datasets requires it, so a
native ARM64 Python cannot install the Studio stack. install.ps1 has swapped a
freshly selected interpreter for x64 since #7549, but every path that REUSES one
checked version and conda-ness only, so a migrated venv or an UNSLOTH_SETUP_PYTHON
handoff still died in a pyarrow source build.

- install.ps1: bootstrap x64 by default on an ARM64 host, re-probe a migrated venv
  and rebuild it through the existing rollback when it is not win-amd64.
- setup.ps1: one Test-CompatibleSetupPythonArch gate on all five interpreter paths,
  a clear failure for an ARM64 environment, and --architecture x64 for winget.
- install_python_stack.py: preflight before the venv is touched.
- install.sh: range-check --python / UNSLOTH_PYTHON instead of surfacing an
  unsupported minor as a bare pyarrow resolver error.

When no x64 interpreter can be obtained, install the ARM64 inference-only tier
(UNSLOTH_NO_DATASETS + .unsloth-no-datasets marker) rather than fail: it drops the
packages with no win_arm64 wheel, gates the dataset routes to 503 and reports
chat_only datasets_unavailable so the UI explains the greyed-out Train.

Fixes #8495
…p tensorboard

UV_OVERRIDE reaches neither a --no-deps install (uv resolves nothing to override)
nor the pip fallback (it does not read the variable), so a lifted scikit-learn was
still installed at its pinned 1.7.1 and source-built. tensorboard requires grpcio,
which has no win_arm64 wheel and cannot build there; only the training worker
writes TensorBoard logs, which this tier does not have.
The skip sets are written with hyphens and the requirement files are not:
extras-no-deps.txt says pytorch_tokenizers and no-torch-runtime.txt says
hf_transfer, so a raw-text filter let both through and the ARM64 install tried to
build them from source.
Only 46.0.0 through 46.0.3 ship one, so studio.txt's open cryptography>=42.0.0
resolved to the newest release and then needed a Rust toolchain to build.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

The <47 ceiling still resolved to 46.0.7, which has no ARM64 Windows wheel; only
46.0.0 through 46.0.3 do.
…arch

# Conflicts:
#	studio/install_python_stack.py
chatgpt-codex-connector[bot]

This comment was marked as resolved.

danielhanchen and others added 2 commits August 12, 2026 18:30
…n settles

It does not depend on the hardware pass and cannot change, so gating it on
DETECTION_COMPLETE left the first health replies with chat_only set and no reason,
and the UI polling for a verdict that was already known.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

Copy link
Copy Markdown
Member Author

The ARM64 inference-only tier is now verified end to end on a real Windows ARM64 host (windows-11-arm runner), which is the part of this PR that could not be proven by unit tests.

Run: install with the tier active, then boot Studio and exercise it.

venv platform tag = win-arm64
datasets is absent, as the tier intends
tier marker present
the server booted without datasets and reports chat_only
  "chat_only": true,
  "chat_only_reason": "datasets_unavailable",
  "chat_only_detail": "Datasets are unavailable in this installation: the datasets library (and pyarrow, which it is built on) publishes no wheels for native ARM64 Windows..."
hub datasets answers 503, not 500

So on a Snapdragon with no x64 Python obtainable: the install completes, the venv stays native ARM64, datasets and pyarrow are absent, the server starts, chat is available, the UI is told exactly why Train is greyed out, and the dataset endpoints degrade with a stated reason instead of a traceback.

Getting there took several rounds and each one was a real bug rather than a flake, so they are worth recording:

  • install.ps1 handed uv the runtime requirements file unfiltered, so sqlite-vec and datasets came back after being dropped everywhere else.
  • The av<16 and pymupdf==1.27.2.3 ceilings in constraints.txt cannot be raised by an override, only removed, so the ARM64 tier filters them out of the constraints file.
  • UV_OVERRIDE reaches neither a --no-deps install (uv resolves nothing, so there is no requirement to override) nor the pip fallback (it does not read the variable), so the version lifts rewrite the pinned lines instead.
  • _filter_requirements compared raw text, so pytorch_tokenizers never matched the skip entry pytorch-tokenizers. It now compares PEP 503 names, with the old prefix arm kept so no existing caller changes behaviour.
  • tensorboard pulls grpcio, whose BoringSSL assembly has no ARM64 Windows target. Only the training worker writes TensorBoard logs, so it is dropped.
  • cryptography publishes win_arm64 wheels for 46.0.0 through 46.0.3 and nowhere else, so an open >=42.0.0 resolves to a release needing a Rust toolchain. Pinned to that window and flagged as a security pin to lift as soon as upstream ships a wheel again.
  • The datasets verdict was gated on DETECTION_COMPLETE, but it does not depend on the hardware pass and cannot change, so the first health replies carried chat_only with no reason and the UI would poll for a verdict already known.

After the last one I stopped finding these one at a time: a strict wheels-only resolution with dependencies now passes for studio.txt, no-torch-runtime.txt and data-designer-deps.txt on aarch64-pc-windows-msvc, and the only remaining blockers in extras are randomname and argbind, which are pure Python sdists that build anywhere and are already covered by SDIST_ONLY_PACKAGES on main.

Also green on the same branch: install.ps1 on windows-11-arm (clean host, swaps to x64 and produces a win-amd64 venv), the venv reuse case (ARM64 interpreter rejected for a full install, accepted for the tier), ubuntu-24.04-arm (install.sh completes, aarch64 Linux untouched), and the Python 3.9 gate.

A platform-isolation audit of this PR found the datasets gate telling the
wrong story to the wrong people. _UNAVAILABLE_MSG was a single constant:

  ...publishes no wheels for native ARM64 Windows... Install x64 Python
  from https://www.python.org/downloads/windows/ (it runs emulated)...

ARM64 Windows is the REASON the gate exists, but it is not the only way to
reach it. datasets_available() answers False in any environment missing the
library, so an ordinary Linux install with a half-finished venv, or anyone
setting UNSLOTH_FORCE_NO_DATASETS=1 to reproduce a report, got told to
download an emulated x64 interpreter for a machine they are not sitting at.
The real remedy was nowhere in the text.

Two messages now. The tier keeps its own, unchanged in substance. Everyone
else gets the plain one: the library is not installed, here is what that
costs you, install it. Both still say what is lost, since that is the part
every caller needs.

The predicate is sysconfig.get_platform() == "win-arm64" behind a win32
check, not platform.machine(), because the question is which wheels THIS
interpreter can install. An x64 Python emulated on ARM hardware answers
win-amd64 and can install pyarrow, so it must not get the tier text -- which
is exactly the state the tier's own advice tells users to reach.

Three tests. The old one asserted the detail always names x64 and arm64,
which enshrined the bug, so it is now split: one that the chosen text names
a fix at all, one that the ARM64 wording cannot leak to anyone else, and one
that pins the predicate against emulation and against Linux and macOS.

    studio/backend/tests/test_datasets_availability.py   23 passed
@danielhanchen

Copy link
Copy Markdown
Member Author

Platform-isolation audit of this PR, against the requirement that a fix for one platform must not change behaviour on the others. One real bug found and fixed in 89fe74f, one scoping point disclosed.

Fixed: the ARM64 advice was reaching everyone

_UNAVAILABLE_MSG in studio/backend/utils/datasets_availability.py was a single constant saying pyarrow "publishes no wheels for native ARM64 Windows" and telling the reader to install emulated x64 Python from python.org. ARM64 Windows is the reason the gate exists, but not the only way to reach it: datasets_available() answers False in any environment missing the library. A Linux user with a half-finished venv, or anyone setting UNSLOTH_FORCE_NO_DATASETS=1 to reproduce a report, got advice for a machine they are not sitting at, with the actual remedy absent.

Now two messages. The tier keeps its own, unchanged in substance; everyone else is told the library is not installed, what that costs, and to install it. The predicate is sysconfig.get_platform() == "win-arm64" behind a sys.platform == "win32" check rather than platform.machine(), because the question is which wheels this interpreter can install: an x64 Python emulated on ARM answers win-amd64, can install pyarrow, and must not get the tier text. That is precisely the state the tier's own advice tells users to reach.

The pre-existing test asserted the detail always names x64 and arm64, which enshrined the bug. Split into three: the chosen text names a fix, the ARM64 wording cannot leak, and the predicate holds against emulation, Linux and macOS. 23 passed.

Disclosed, not changed: the --python gate is cross-platform

The --python / UNSLOTH_PYTHON range check added at install.sh:442-470 is in the Linux and macOS installer; Windows never runs install.sh. So a PR titled "Windows on ARM" does change behaviour on two other platforms.

I am leaving it, and here is the reasoning rather than a bare assertion. It hard-fails only --python values below 3.10, which provably cannot install: constraints.txt pins pyarrow==23.0.1, which has no cp39 wheel on any platform, and matplotlib, pymupdf, pymupdf4llm and fastmcp are 3.10+ as well. Without the gate that resolution failure still happens, minutes later, as a bare dependency name. It fires only when the flag is passed explicitly, leaves paths and uv download names untouched, and warns rather than fails above 3.13. install.ps1 has enforced a 3.11-3.13 window all along.

It is a self-contained 29-line block and would split out cleanly into its own PR if you would rather it not ride here. Say the word.

The rest of the audit

Everything else in this PR is behind IS_WINDOWS and sysconfig.get_platform() == "win-arm64" at install_python_stack.py:74. WSL takes the Linux branch, which is correct: WSL is aarch64 Linux, where every wheel this PR works around does exist.

Stated plainly: there is no Windows machine here. Every claim above is a static trace of the guards through this PR's tree, plus the tests, not an observation on ARM64 Windows. I did not check PyPI for the win_arm64 wheel claims and did not run pwsh.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

UNSLOTH_NO_DATASETS=1 turns the inference-only tier on for an x64 install
too, and Get-ArmFilteredRequirements then rewrote pymupdf, av, scikit-learn
and cryptography to their ARM64 floors on a machine where the pinned,
tested versions all have wheels. install_python_stack.py already gated its
own lift on IS_WINDOWS_ARM64_PYTHON; the PowerShell half now matches.

The skips still apply on both halves: asking for no datasets means no
datasets whatever the architecture.
@danielhanchen

Copy link
Copy Markdown
Member Author

Simulation results for this PR

Ahead of merging I wanted the before/after answered by something other than reading the diff, so I ran the resolver and the runtime directly. Nine simulations, all on this branch, plus the real windows-11-arm CI already linked above.

Before this PR

uv pip compile studio.txt -c single-env/constraints.txt --python-platform aarch64-pc-windows-msvc --only-binary :all: does not resolve. It stops at the first pin with no win_arm64 wheel, and there are eleven of them in total. Package by package, against PyPI:

package pinned native ARM64 Windows x64 Windows
datasets 4.3.0 uninstallable (pyarrow) installs
ddgs 9.14.4 uninstallable installs
hf-transfer 0.1.9 no wheel installs
mecab 0.996.13 no wheel installs
pandas 2.3.3 no wheel installs
pytorch-tokenizers latest no wheel installs
sqlite-vec 0.1.9 no wheel installs
tensorboard 2.21.0 uninstallable (grpcio) installs
tiktoken 0.13.0 no wheel installs
torch-c-dlpack-ext 0.1.5 no wheel installs
trl 0.23.1 uninstallable (datasets) installs

So the report is a real failure, not a configuration mistake: on a native ARM64 interpreter the install cannot succeed at any version. Four of those are pure Python and ship a py3-none-any wheel of their own; they are unusable because of what they pull in, which is why a wheel-by-wheel look at the named package alone is misleading.

After this PR

The same resolution completes with 104 packages, wheels only, no source build. datasets, pyarrow, trl, sqlite-vec, tiktoken and pandas are absent; fastapi, uvicorn, pydantic, typer and huggingface-hub are present, which is what chat and model downloads need.

Does it change anything for existing users

target pre-PR post-PR
windows x64 129 packages 129 packages identical versions
windows arm64 fails to resolve 104 packages fixed
linux x86_64 128 packages 128 packages identical versions
linux aarch64 128 packages 128 packages identical versions
macos apple silicon 126 packages 126 packages identical versions
macos intel 126 packages 126 packages identical versions

Every non-ARM64-Windows target resolves to exactly the same package set at exactly the same versions as before. The installer also renders byte-identical uv commands on all eight OS/arch cells outside native ARM64 Windows, checked by loading the pre-PR and post-PR modules side by side with sys.platform, platform.machine() and sysconfig.get_platform() patched.

Other things pinned down:

  • Old installs. A manifest written before this PR has no no_datasets key and reads back as unknown, so nothing switches tier on update. The key is additive, so the pre-PR code reads a new manifest without error and still answers correctly about no-torch. Corrupt, truncated and ANSI-re-saved manifests degrade to unknown rather than to a wrong tier.
  • Studio. Across 4 operating systems x 5 GPU types (NVIDIA, ROCm, XPU, CPU-only, MLX), with datasets installed the health verdict is exactly what it was before on every cell. Without it, every cell reports chat_only with datasets_unavailable and a detail, and the gated routes answer 503 rather than 500.
  • The availability probe. In a throwaway venv where datasets is genuinely absent (not forced by the test hook) it reports unavailable, raises 503, and does so without importing datasets or pyarrow; installing datasets into the same venv flips it back with no code change.
  • The install.sh version gate. 33 inputs across dash, bash, bash --posix, zsh and busybox ash agree: supported versions pass, only provably unresolvable ones fail, and nothing (paths, uv download names, prereleases like 3.13rc1, globs) aborts the shell.
  • The requirements filter. The PowerShell and Python halves drop and lift the same distributions across all 13 real requirement files, including CRLF files and underscore spellings.
  • Frontend npm run typecheck passes. The only UI change is a string in an existing branch, so there is no browser-specific surface.

Test suites

Run on this branch and on main in the same environment, so the pre-existing failures in this box (no GPU headroom for some tests, no fastmcp, no sqlite-vec, no pymupdf, an older datasets.config) can be told apart from anything new:

suite main this branch
studio/backend/tests 170 failed, 22242 passed, 82 errors 169 failed, 22313 passed, 82 errors
tests/sh/*.sh - 47 of 47 pass

The failure sets differ by three tests, all of them flaky or environment-bound and none touching this change: two fail on main and pass here, one (test_studio_mcp_surface_refuses_stdio_recipes, from #8551) fails on import fastmcp, which is not installed in this environment. The 71 extra passing tests are the ones this PR adds.

One fix from the simulations

Get-ArmFilteredRequirements applied the version lifts whenever the tier was on, including the UNSLOTH_NO_DATASETS=1 opt-in on an x64 host, where the pinned versions are the tested ones and all have x64 wheels. install_python_stack.py already gated its own lift on IS_WINDOWS_ARM64_PYTHON; the PowerShell half now gates on the host arch to match. Skips still apply on both, since asking for no datasets means no datasets whatever the architecture. Three regression tests cover it.

Sixteen review findings against the Windows-on-ARM tier, grouped by what they
actually break.

The tier could never verify. verify_install() checked the whole of studio.txt
regardless of the tier it had just recorded, so an install that deliberately
omits datasets, pandas, sqlite-vec and ddgs reported studio_deps_missing on
every single verification: setup forced another dependency pass each run and the
desktop preflight rejected it. missing_requirements() now takes the omissions
and verify_install() reads them from the recorded tier. overrides-win-arm64.txt
joins the tracked requirement files -- on a --local ARM64 install it decides the
installed PyMuPDF, PyAV, scikit-learn and cryptography, and untracked, editing it
left the fingerprint unchanged.

The tier could not import unsloth. trl was skipped as "requires datasets
unconditionally", but it is a py3-none-any wheel that installs on ARM64, every
step that installs it is a --no-deps step, and its __init__ is a _LazyModule with
no eager datasets reference. unsloth/models/_utils.py imports it unconditionally,
so dropping it made line 6 of the inference worker raise ModuleNotFoundError in a
tier that advertises chat. openai-whisper takes its place: extras.txt is the one
step resolved with dependencies and Whisper declares tiktoken, so filtering the
direct tiktoken line let uv pull it in transitively and source-build it anyway.

The fresh ARM64 branch installed unsloth --no-deps plus pydantic and then ran
`unsloth studio setup`, whose entry point imports typer at module scope -- it now
lays down the filtered no-torch-runtime.txt like the two other --no-deps
branches. The fallback's UNSLOTH_NO_DATASETS export is restored afterwards, or an
`irm | iex` shell stays pinned to the tier through the x64 retry the failure
message itself asks for. Opting in now selects a native interpreter rather than
accepting whatever the py launcher hands out first, which on a mixed box was an
emulated x64 build with the training packages stripped: the disadvantages of both
tiers. setup.ps1 accepts the whole documented truthy set instead of only "1", and
treats a present-but-ARM64 interpreter as no usable Python so the x64 winget
bootstrap can run instead of hard-exiting "no supported version" on a machine
with a supported 3.12.

The gate covered one mount of three. /api/datasets is the retained compatibility
alias and reaches the same formatting service; Data Recipes reads seeds through
pandas and load_dataset; the diffusion example importer runs load_dataset
directly; and mcp_server calls start_training() as a function, where FastAPI
never runs the decorator dependency. All four answer 503 now. The probe also asks
for pyarrow: datasets on disk without its storage engine passed the gate and then
raised ModuleNotFoundError, which is the 500 this exists to replace.

Finally, chat_only=datasets_unavailable no longer hides models. Every other
chat-only reason is a statement about the runtime; this one is not, and reusing
it made ordinary safetensors models unselectable on an install that keeps torch
and Transformers. Data Recipes is what the tier actually loses, so that is what
the sidebar greys out.

install.sh rejects 3.15+ outright rather than warning: pyproject declares
requires-python <3.15, so uv cannot install unsloth there at all, which is the
late resolver failure this guard was added to replace.
@danielhanchen

Copy link
Copy Markdown
Member Author

16 of the 17 inline items are genuine and fixed in f953cc6, each with a named test that goes red if the fix is reverted. The four review bodies are boilerplate headers with no content.

The two worst were reachable in the tier's normal path. verify_install called missing_requirements(studio.txt) unconditionally, and studio.txt names datasets, pandas, sqlite-vec and ddgs, every one of them in the skip list, so a correct tier install reported studio_deps_missing forever. And dropping trl breaks import unsloth outright: unsloth/models/_utils.py does from trl import __version__, reached through _gpu_init into .models, and inference.py imports FastLanguageModel. Your conclusion there is right but the stated reason is not: I removed datasets and pyarrow from a shadow site-packages and trl 0.25.1 still imports cleanly, and trl 0.23.1's wheel is py3-none-any with no eager datasets reference in __init__.py. The break is our own import, not trl's dependency.

Three gating holes are now closed: the legacy /api/datasets and /api/data-recipe mounts, and /diffusion/dataset/import-example, all of which reach load_dataset. The MCP one is worth calling out because it is not a routing bug: mcp_server.py calls await start(request, ...) directly, and a decorator dependency never runs on a direct call, so that one needed an explicit check in the body.

On the chat_only verdict hiding safetensors, agreed, but the blast radius is narrower than stated: an ARM64 Windows box has no CUDA or ROCm, so detect_hardware returns chat_only with reason no_gpu regardless. The regression bites the non-ARM datasets-missing case instead. The exemption is keyed on datasets_unavailable for that reason.

The CodeQL alert is a false positive and I have reacted accordingly. The flagged message is PowerShell source text, not a URL, and the assertion is a test expectation rather than a security control; no URL is validated anywhere on that path. I did tighten the assertion to the full command string, as hygiene. Worth noting the "python.org" half of that or was dead, since the ARM64 error message never prints python.org.

Counts after the round: datasets_availability 23 to 36, windows_arm64_python_choice 19 to 37, cross_platform_parity 87 to 89, install_python_stack 62 to 68, the shell guard 36 to 41. Wider regression run 334 passed, 11 skipped. The PowerShell tests execute Find-CompatiblePython verbatim under pwsh 7.6.0 against fake interpreters rather than asserting on source text.

Two things I want on the record rather than buried. There is no Windows-on-ARM machine here, so the central predicate, that sysconfig.get_platform() returns win-arm64 natively and win-amd64 under emulation, rests on the CPython contract and PEP 11, not on execution. And separately: probing the import with no accelerator visible, unsloth_zoo/device_type.py raises NotImplementedError("Unsloth cannot find any torch accelerator? You need a GPU."). Windows on ARM has neither CUDA nor ROCm, so if that path is reached, restoring trl is necessary but not sufficient and the tier's advertised chat is broken a layer below this PR. That needs its own answer.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f953cc6409

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread studio/backend/main.py Outdated
Comment on lines +1467 to +1468
if not datasets_available():
return True, "datasets_unavailable", datasets_unavailable_detail()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exempt the dataset-only tier throughout the model picker

When the inference-only tier is active, publishing chat_only=True still makes the primary model picker hide supported safetensors models: features/model-picker/components/model-selector/pickers.tsx uses raw chatOnly in the recommended-model filter, local-directory filter, and visibleCachedModelRows. The chat-adapter exemption added after the prior review only fixes autoload validation; users opening the picker still cannot select or download the Transformers models this tier retains. This remaining direct picker gating is fresh evidence that the dataset-only verdict needs a training-specific capability or the same reason exemption throughout the picker.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one: the picker behaves identically with and without this PR on that machine. The tier is a native ARM64 Windows box with CPU-only torch, so detect_hardware() reaches the CPU fallback and sets CHAT_ONLY = True with reason no_gpu (utils/hardware/hardware.py:646) whatever this verdict says. All this change does there is replace the reason string with one that explains itself. Showing safetensors models on chat-only hosts is a separate feature covering every CPU-only Linux, Windows and Intel Mac install, not something this PR regressed.

Comment thread install.ps1
Comment on lines +2229 to 2231
$wanted = $sameMinor | Where-Object { $_.Arch -eq $wantedArch } | Select-Object -First 1
if ($wanted) { return $wanted }
if (-not $X64Only) { return $sameMinor[0] }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bootstrap ARM64 Python for an explicit native-tier request

On an ARM64 host with only an x64 Python installed, UNSLOTH_NO_DATASETS=1 finds no native candidate here and then falls through to returning that x64 candidate. Because $DetectedPython is non-null, the installer never reaches the ARM64 winget/python.org bootstrap, while the later inference-only branch still strips the training dependencies, producing the disadvantages of both tiers. Fresh evidence after the prior selection fix is this explicit fallback to $sameMinor[0]; return no candidate when $preferArm64 cannot be satisfied so the install path obtains a native interpreter.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one: UNSLOTH_NO_DATASETS=1 is an explicit opt-in for an install without the datasets stack, not a request for a native interpreter. Returning no candidate so the ARM64 bootstrap runs would install a second, native Python on a machine that already has a working x64 one, and build the venv on the interpreter with fewer wheels. The x64 candidate is the better environment, and the tier still installs everything except what was opted out of.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 27c783da29

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 179989efd5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread install.sh Outdated
Comment on lines +491 to +503
case "$_USER_PYTHON" in
*/*|*\\*)
# A path names an interpreter just as "3.9" does, so ask it rather than
# letting it through: /usr/bin/python3.9 hit the same 3.11-only plugins
# this gate exists to catch, only minutes later and under another name.
# Skipped when it cannot be run: resolving the request is not this gate's
# job, and the steps below report a bad path themselves.
_probe_ver=$("$_USER_PYTHON" -c 'import sys; print("%d.%d" % sys.version_info[:2])' 2>/dev/null || true)
case "$_probe_ver" in
[0-9]*.[0-9]*)
_req_major=${_probe_ver%%.*}
_req_minor=${_probe_ver#*.} ;;
esac ;;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Probe bare interpreter names before accepting them

When --python or UNSLOTH_PYTHON names an executable on PATH (for example python3.9) rather than a path containing / or \, this case matches neither arm, so the new range gate accepts it and later passes it to uv venv --python; the local uv venv --help describes that option as accepting a Python interpreter, and uv python find python3.13 confirms bare executable names resolve. Consequently this common spelling still creates an unsupported 3.9/3.10 environment and encounters the late dependency failure the gate is intended to prevent; probe non-version interpreter requests through command -v as well as explicit paths.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. A request that is neither a version nor a path now resolves through command -v and is probed the same way a path is, so python3.9 is refused and python3.12 is accepted. A uv download name (cpython-3.12-linux-x86_64-none) is not on PATH, so it still passes through untouched. The probe also takes the minor only up to the next dot now: it asks for two fields, but a wrapper answering 3.9.1 would otherwise abort dash with "Illegal number". The shell guard suite covers all of it, 52 passed under sh, dash and bash.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae8e4d6893

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

assert "$applyLifts = ((Get-HostMachineArch)" not in body


def test_lifts_do_not_apply_on_an_x64_host():

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip the x64 lift test without PowerShell

On Linux or other minimal environments where pwsh is unavailable, this test calls _pwsh() unconditionally and fails with FileNotFoundError before reaching its assertions. The PowerShell availability decorator is currently attached to the preceding source-only test, while all neighboring tests that execute _pwsh() are skipped appropriately; move or add the decorator here so the suite remains runnable without PowerShell.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. The guard moved to test_lifts_do_not_apply_on_an_x64_host, and came off test_lifts_follow_the_venv_interpreter_not_the_host, which only reads install.ps1 as text. Added an AST check over this file so the next one cannot drift: it fails if any test that calls _pwsh() lacks the skipif. Verified both ways, 53 passed with pwsh on PATH and 25 passed / 28 skipped with it removed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b8e2cc222

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +4343 to +4344
if actual_req is not None and NO_DATASETS and NO_DATASETS_SKIP_PACKAGES:
actual_req = _filter_requirements(actual_req, NO_DATASETS_SKIP_PACKAGES)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit ARM-only skips to ARM64 interpreters

When UNSLOTH_NO_DATASETS=1 is used on x64 Windows or Linux, this unconditional filter removes the entire ARM64 wheel-gap set, not just the datasets stack. Packages such as sqlite-vec, ddgs, openai-whisper, librosa, and pytorch-tokenizers are therefore omitted even though they are installable on those platforms, disabling RAG, web search, speech-to-text, and model-specific inference features. Split the dataset-specific omissions from the win-arm64-only omissions, or apply the latter only when IS_WINDOWS_ARM64_PYTHON is true.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by splitting the two reasons. NO_DATASETS_SKIP_PACKAGES is now just the data stack (datasets, pandas), dropped wherever the tier is on; the wheel gap moved to WIN_ARM64_SKIP_PACKAGES, filtered only when IS_WINDOWS_ARM64_PYTHON. So an x64 UNSLOTH_NO_DATASETS=1 install keeps sqlite-vec, ddgs, openai-whisper, librosa, tiktoken and the export helpers, and with them RAG, web search and speech-to-text. Verification follows: WIN_ARM64_OMITTED_REQUIREMENTS is only added to the omit list when the manifest records a win-arm64 interpreter, so an x64 tier install that really is missing those still reports studio_deps_missing. The install.ps1 list is the union, since that path only runs on ARM64, and the parity test now compares it against both sets.

Comment thread studio/backend/routes/training.py Outdated
Comment on lines +4228 to +4229
if entry.get("loader") == "hf_dataset":
await require_datasets_http()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve idempotent imports without datasets

When an hf_dataset example's destination already contains images or clips, this endpoint promises to return the existing folder without loading anything, but the new dependency check returns 503 before the no-op check at lines 4236-4238. This blocks users who imported an example before moving to the inference-only tier from reusing that already-materialized diffusion dataset, even though diffusion training remains supported there. Defer the datasets check until the code has established that _materialize_hf_dataset() will actually run.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. The gate moved off the route to the point where _materialize_hf_dataset is about to run, after the emptiness check, so an already-materialized folder is still returned as-is on the tier. That path is synchronous under the import lock, so it calls a new require_datasets_sync() that raises the same 503; require_datasets_http stays async for the dependency callers.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 031884490f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@oobabooga

Copy link
Copy Markdown
Member

I reviewed the premise, interpreter selection and reuse paths, native ARM64 fallback, runtime gating, and cross-platform impact. I found no concrete merge blocker.

The problem is real and the fix is at the correct layer. Studio's dataset preparation and training stack uses Hugging Face datasets, which requires pyarrow. A wheels-only uv resolution for pyarrow>=21 fails on native Windows ARM64 but resolves for x64. Windows can run x64 Python through its built-in emulation, making the compatible x64 wheels available and enabling the full Studio feature set. Using sysconfig.get_platform() correctly tests that interpreter ABI rather than merely checking the host architecture. The PR applies the check across clean installs, reused interpreters, migrated environments, and the direct stack installer.

If x64 Python cannot be installed, or the user explicitly chooses native ARM64, the PR falls back to an inference-only tier instead of failing the installation. Its state persists across updates, unresolvable dependencies are filtered, dataset and training entry points return an explicit unavailable response, and health plus frontend capability handling preserves chat and supported inference features. The tier remains inert unless selected, and the manifest handling avoids invalidating existing non-ARM installs.

The public Windows ARM clean-install job passes. Locally, the installer parity, Python stack, manifest, datasets availability, interpreter guard, and health capability suites all passed, including 384 focused test cases plus the executable Windows ARM64 selection cases. install.sh also parsed under both bash and dash.

Recommendation: MERGE.

@danielhanchen

Copy link
Copy Markdown
Member Author

Confirmed the reuse paths in install.ps1 and setup.ps1 only check version and conda today, so an ARM64 interpreter does get reused and lands on the pyarrow build. The direction is right, but this also carries the Linux --python range check, the sidebar and status changes and the whole no-datasets tier; could you split the interpreter arch fix out so it can land on its own, and take a look at Backend CI on Python 3.11, which passes on main and on the last ten merged PRs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Desktop and Studio Dont Install on Snapdragon X2 Elite (Windows and Linux alike)

3 participants