Skip to content

[Bug] Installer's Intel XPU Triton replacement fails silently, leaving triton-windows shadowing torch XPU Triton (setup.ps1:4717)` #10018

Closed

Description

@ahillelt

title: "[Unsloth Bug] Installer's Intel XPU Triton replacement fails silently, leaving triton-windows shadowing torch XPU Triton

Environment

Where are you using Unsloth?

  • Unsloth desktop application
  • Unsloth web UI (unsloth studio)
  • Unsloth CLI
  • Python package or notebook
  • Colab or Kaggle

Operating system and version: Windows 11, build 26200.9278

GPU model(s) and accelerator backend: Intel(R) Arc(TM) 140V GPU (16GB), integrated, Intel Core Ultra 258V. Intel XPU backend.

Versions: Unsloth 2026.8.22, Python 3.13.15, torch 2.10.0+xpu, llama.cpp b10687-mix-67dfc8b

What happened?

Steps to reproduce:

  1. Run the Unsloth Studio desktop installer on a clean Windows 11 machine with an Intel Arc integrated GPU.
  2. Let it complete. It reports success.
  3. Start Studio.

Expected behavior: The XPU-compatible Triton build is installed, as the installer states it is doing.

Actual behavior: The step fails, emits a [WARN], and setup continues to completion and reports "Unsloth Studio Setup Complete". The incompatible triton-windows build is left in place, shadowing torch's XPU Triton. Studio then fails at startup with:

Failed to import ML libraries: cannot import name 'intel' from 'triton._C.libtriton'

Model and operation involved: Installation. Affects every subsequent XPU operation.

Diagnostics and logs

Desktop application

[1788059259888]                  installing bitsandbytes with Intel XPU kernels...
[1788059260301]                  replacing triton-windows 3.8.0.post28 with triton-xpu==3.6.0 (Intel XPU)...
[1788059261701]                  [WARN] could not fetch triton-xpu==3.6.0 (exit 1); triton-windows 3.8.0.post28
                                 left in place -- it still shadows torch XPU triton, so torch.compile will not
                                 use the XPU.
[1788059261705] python.exe : ERROR: Directory 'C:\Users\USER\AppData\Local\Temp\unsloth_triton_xpu_0da4251b'
                is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
[1788059261707] At C:\Users\USER\.unsloth\studio\unsloth_studio\Lib\site-packages\studio\setup.ps1:4717 char:9
[1788059261708] +         & python -m pip download @Args_ 2>&1

Then, about ~30 seconds later:

[1788059294556]   ────────────────────────────────────────────────────
[1788059294556]   Unsloth Studio Setup Complete

Additional context

Likely cause

The package name at setup.ps1:4717 appears to be wrong. The step requests triton-xpu==3.6.0. The XPU Triton build published on the PyTorch XPU index is named pytorch-triton-xpu. The pip download returns exit 1, leaving an empty temp directory, which the subsequent install then rejects with "Neither 'setup.py' nor 'pyproject.toml' found".

Work around without modifying unsloth base (but it will cause other breaks in export of model):

# remove the shadowing package and its orphaned metadata
Remove-Item -Recurse -Force "<venv>\Lib\site-packages\triton"
Remove-Item -Recurse -Force "<venv>\Lib\site-packages\triton-*.dist-info"
Remove-Item -Recurse -Force "<venv>\Lib\site-packages\pytorch_triton_xpu-*.dist-info"
Remove-Item -Recurse -Force "$HOME\.triton\cache"

# correct package name, correct index
& $py -m pip install --force-reinstall --index-url https://download.pytorch.org/whl/xpu pytorch-triton-xpu

Please verify the intended package name and index at setup.ps1:4717. I have not confirmed that triton-xpu does not exist on any index, only that the documented XPU wheel is pytorch-triton-xpu and that installing it by that name resolves the problem.

Proposed fixes

  1. Correct the package name and index at setup.ps1:4717.
  2. Do not report setup as complete when a required XPU component failed to install. That should be a hard failure on an XPU machine, not a [WARN] followed by a success banner.
  3. Remove orphaned dist-info when replacing a package. The leftover triton-*.dist-info directories cause Studio to flag installed-metadata conflicts later.
  4. Verify after install. from triton._C.libtriton import intel is a one-line check that would have caught this at install time rather than at first use.

Downstream effects

This single failure will cause other bugs with optimizers, and GGUF exports.

Activity

  1. added
    feature request
    on Aug 30, 2026
  2. oobabooga commented on Sep 2, 2026

    @oobabooga
    Member

    I'm closing this as the headline bug is fixed by #10073. If you experience any other problem, please feel free to create separate issues.

  3. ahillelt commented on Sep 13, 2026

    @ahillelt
    Author

    Thanks for the first round of patches. The error has moved one layer down.

    Unsloth Version: v0.1.808-beta
    Package Version: 2026.9.4
    Hardware: Intel Arc 140V (Core Ultra 258V), Windows 11, XPU backend

    Clean install: wiped ~/.unsloth, ran uninstall.ps1, purged the uv and pip caches, reinstalled from scratch.

    Full fine-tune works launched normally, from either the desktop app or unsloth studio in PowerShell. Selecting 4-bit / QLoRA fails with:

    We encountered some issues during automatic conversion of the weights.
    For details look at the CONVERSION entries of the above report!

    The weights are fine (incorrect error message). The real error is in the log:

    RuntimeError: Failed to find C compiler. Please specify via CC environment variable

    On XPU, bitsandbytes has no native kernel and falls back to its Triton backend, which JIT-compiles at runtime and needs a host C compiler. Without one, every tensor fails to convert, and transformers reports that as a weight problem. Nothing in the user-facing message points at the actual cause.

    I installed MSVC Build Tools and Intel oneAPI manually, then wrote a launcher because Studio doesn't set up the environment Triton needs to compile. The identical 4-bit run then succeeds. The install is the same in both cases; only the environment Studio inherits changes.

    bat
    @echo off
    call "C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.4
    set "LIB=C:\Program Files (x86)\Intel\oneAPI\compiler\2026.1\lib;%LIB%"
    set CC=C:\Program Files (x86)\Intel\oneAPI\compiler\2026.1\bin\icx.exe
    set CXX=C:\Program Files (x86)\Intel\oneAPI\compiler\2026.1\bin\icpx.exe
    unsloth studio -H 0.0.0.0 -p 8888

    Three things Studio doesn't currently do correctly that this script solves:

    Loads the MSVC environment. icx is a front end over MSVC and won't run without it. Studio's setup does check for Visual Studio, but records it as only needed for a llama.cpp source build, which isn't right on XPU.
    Points CC/CXX at the Intel compiler. Triton's Intel backend emits GCC-style flags, so cl.exe can't be substituted.
    Adds oneAPI's lib to LIB. Triton's own -L flags don't cover Intel's runtime libraries well, so the link fails without it.

    Also worth noting: oneAPI must stay off PATH and setvars.bat must not run, or Triton resolves SYCL to a directory that doesn't have sycl8.lib. Following Intel's documented setup breaks this.

    This works, but it's user setup that should be handled internally. The compiler runs in a subprocess Studio spawns, so the only way a user can influence it is by controlling the parent's environment.

    Possible fixes, depending on your workflow and direction for Unsloth Studio and XPU support on Windows:

    1. Ship the driver module prebuilt. In every traceback from the log the compiler is invoked at the same place:

    driver.py, line 309, in init
    mod = compile_module_from_src(src=Path(os.path.join(dirname, "driver.c")).read_text(), name="spirv_utils")

    That's a fixed C extension wrapping Level Zero and SYCL. The source is identical for everyone on a given Python and Triton version and doesn't depend on the model or kernels, so it "could" ship as a prebuilt .pyd in the wheel. Kernel compilation itself goes to SPIR-V in-process via bundled LLVM and doesn't need a host compiler. I haven't verified whether the Intel backend also builds a per-signature launcher stub through the same path, so this may reduce rather than eliminate the requirement.

    1. Route XPU 4-bit through torchao instead of bitsandbytes. Unsloth installer seems to install torchao

    torch 2.10.0+xpu detected -- installing torchao==0.16.0

    torchao is already a dependency and its int4 support doesn't rely on bnb's Triton fallback. This is the only option that removes the toolchain dependency outright rather than managing it. I checked in the logs, the traceback goes to transformers/integrations/bitsandbytes.py and bnb.nn.Params4bit, with no torchao frame anywhere. So torchao is sitting there unused for this operation, but you have it available.

    1. As a stopgap, not great one, detect the toolchain and inject the environment. Locate MSVC and oneAPI at setup and set CC, CXX, and LIB for spawned subprocesses. If they can't be found, fail at setup naming what's missing rather than later as a weight conversion error. I'd treat this as a fallback rather than the fix: it makes you responsible for a version matrix you don't control, including the MSVC 14.51 incompatibility that forces an explicit 14.4x pin, and the requirement that oneAPI stay off PATH so find_sycl resolves correctly. Both are properties of current Intel and Microsoft releases and will need maintaining.

    Log (username sanitized as <SANITIZED_ACCOUNT>): https://gist.github.com/ahillelt/82cace17fdd180238617179395da8536

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfeature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions