Skip to content

Studio engines: find a per-user uv for vLLM / SGLang installs, and tell a retried failure apart - #18504

Merged
oobabooga merged 4 commits into
unslothai:mainfrom
debojyoti-dev:fix/engine-install-user-uv-18492
Nov 20, 2026
Merged

oobabooga merged 4 commits into
unslothai:mainfrom
debojyoti-dev:fix/engine-install-user-uv-18492

Conversation

@debojyoti-dev

Copy link
Copy Markdown
Contributor

Fixes #18492.

What this changes

Finding uv. The vLLM / SGLang install looked for uv only with shutil.which("uv"). Studio's web UI, systemd/launchd service and desktop launches don't read the shell profile that adds ~/.local/bin to PATH, so a uv installed per user by its standalone installer was never found and the install failed with uv is unavailable. Repair the Unsloth installation and retry. The installer now uses the same lookup as the other Studio installers (cosmos guardrail, NVFP4, sd.cpp cuDNN): utils.mlx_repair._uv_executable, which tries PATH first and then ~/.local/bin, ~/.cargo/bin, /opt/homebrew/bin and /usr/local/bin.

Telling a retry's failure apart from the last one. A retry that failed the same way left the page exactly as it was, so it looked like nothing happened.

  • The job file now records finished_at when an attempt ends (success, error, cancelled, waiting). A new attempt clears it.
  • Settings > More engines shows "Last attempt: " (seconds included, following the time-format setting) under the failure.
  • Opening the install prompt for a retry hides the previous failure and its technical details, so the result that comes back is clearly the new attempt.
  • One new string, managedEngines.lastAttempt, translated in all 25 locales.

Screenshots

Settings > About > More engines, real browser, /api/engines answered in-process by each tree's own engine_install (status / start_install) with uv missing everywhere. Only the GPU / WSL gates were bypassed, since this machine has no supported GPU.

Before (main) After
First failure
Install prompt opened for a retry
Retry failed the same way

Testing

Real install in a Linux container (Debian bookworm), set up like the report: uv 0.9.5 only in /home/chris/.local/bin, a Studio venv without uv, and the process started with PATH=<studio venv>/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin (no .bashrc). Two attempts through engine_install.start_install("vllm"), with only support_reason / gpu_platform replaced (no NVIDIA GPU in the container). Each attempt is cancelled once the real uv pip sync is downloading.

main:

PATH lookup shutil.which('uv') -> None
--- attempt 1: job: ('error', None, 'uv is unavailable. Repair the Unsloth installation and retry.')
--- attempt 2: job: ('error', None, 'uv is unavailable. Repair the Unsloth installation and retry.')

this branch:

PATH lookup shutil.which('uv') -> None
installer lookup -> /home/chris/.local/bin/uv
--- attempt 1
  job: ('running', 'creating', 'Preparing an isolated Python environment')
  job: ('running', 'installing', 'Downloading and installing engine packages')
  real `uv venv` created: ['/home/chris/.unsloth/studio/engines/vllm/env-d421.../bin/python']
  activity: Resolved 199 packages in 3.06s
  job: ('cancelled', None, 'Installation cancelled.')

With uv removed from ~/.local/bin too, both attempts still fail with the same message, now with different finished_at values (1795105638.08 and 1795105640.15).

Tests

  • New studio/backend/tests/test_engine_install_uv_lookup.py (4 tests: per-user uv off PATH is used, PATH still wins, each attempt records its own end time, progress updates don't end an attempt). All 4 fail on main.
  • New studio/frontend/tests/engine-install-last-attempt.test.ts (SSR render of EngineInstall: failure shows its time, two failures render differently, older backends without finished_at still show the failure, a running retry hides the old failure).
  • Linux container: test_managed_engines.py, test_engine_atomic_json.py, test_engine_status_stays_cold.py + the new file: 272 passed, 1 skipped (main: 268 passed, 1 skipped).
  • Windows: test_managed_engines.py 199 passed, 3 failed, the same 3 that fail on clean main here (test_engine_cuda_home_is_the_locked_pip_nvcc, test_docker_engine_python_survives_image_replacement[*]); test_managed_engines_rocm, test_engine_atomic_json, test_engine_status_stays_cold, test_managed_engine_offer, test_wsl_host all pass.
  • Frontend: full npm test 16,775 tests, 16,773 pass; the 2 failures (escaped-inline-math, markdown-cut-reply-repair, both timing-based) pass when rerun alone; npm run typecheck passes; npm run i18n:check:strict passes; eslint on the changed files reports only the 3 errors already present on main.

Not covered: a complete vLLM/SGLang install on a real supported GPU (this machine has an RTX 3050 on driver 566, below the 580 the engines need), and macOS.

…ure apart

The vLLM / SGLang install looked for uv only on PATH, so a uv installed in
~/.local/bin was missed whenever Studio started without the shell profile
that adds it. Use the shared uv lookup the other Studio installers use.

The job file now records when each attempt ended, Settings shows
"Last attempt: <time>" under a failed install, and opening the install
prompt for a retry hides the previous failure.

Fixes unslothai#18492
@oobabooga

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T20:15:43.688525Z ab79683 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: ab79683e1f

ℹ️ 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".

danielhanchen added a commit that referenced this pull request Nov 19, 2026
…route effect from #18420 (#18534)

## Summary

Two tests in `studio/frontend/tests/image-generation-defaults.test.ts`
fail on `main` (seen in `Frontend unit tests (Windows)` on #18504, which
only touches engine installs; they fail the same way on Linux):

```
not ok - routed image picks apply and transactionally roll back model defaults
    assert.ok(routeStart >= 0 && routeEnd > routeStart)
not ok - a base file in a Turbo / Flash folder or repo keeps the backend's recipe, not the distilled one
    /models/chroma1-flash Chroma1-HD.safetensors
    + { guidance: 3.5, steps: 26 }   - { guidance: 0, steps: 9 }
```

## Root cause

Both come from #18420, and in both the product change is intended:

- **Route test.** It located the routed-pick block between `const pick =
diffusionRoutePick(` and the comment `// Reload the current model with
the current advanced options.`. #18420 removed that comment, so the end
anchor was not found. The route effect itself still applies defaults
through `applyImageModelDefaults(wanted, "auto", ...)` and rolls back
with `revertPick(revert)` when the load does not start.
- **Base file in a Flash folder.** #18420 filled in the frontend
defaults table to match the backend row for row (Chroma, Anima, Krea,
`flux1-*`, MiniMax-H3-Image). The test pinned `{ steps: 9, guidance: 0
}`, which was the fallback a base Chroma1-HD file got while the table
had no Chroma row. It now gets Chroma's own recipe (26 / 3.5), which is
exactly what the test's name promises: the base file's recipe, not the
Flash one (16 / 1).

## Changes

- Route test: the block ends at the effect's own dependency list
(`]);`), so it no longer depends on a comment. The four assertions
inside it are unchanged.
- Base-file test: each case now asserts the key resolves to the base
file's own recipe (`defaultsFor(file)`) and is not the distilled recipe
(Anima-Turbo 10 / 1, Chroma1-Flash 16 / 1), instead of pinning whatever
number the table held at the time.

Test-only change.

## Testing

- `node --test tests/image-generation-defaults.test.ts`: 26 passed (2
fail on `main`).
- Sabotage, each against this branch:
- `defaultsKeyFor` returning a Flash / Turbo folder's own key before the
file's: the base-file test fails (along with two neighbours that guard
the same rule).
- Dropping the route effect's `revertPick(revert)`: the route test
fails.
@oobabooga

Copy link
Copy Markdown
Member

Thanks @debojyoti-dev. vLLM and SGLang installs failed with "uv is unavailable. Repair the Unsloth installation and retry." when uv was installed per user in ~/.local/bin (#18492), because _install in engine_install.py only looked for uv with shutil.which("uv"), and web UI, service and desktop launches don't read the shell profile that adds ~/.local/bin to PATH. This is a sibling path fix: Studio's other installers already find uv through utils.mlx_repair._uv_executable, which still tries PATH first, and this installer now uses it too.

With PATH=/usr/bin:/bin and uv only in ~/.local/bin:

shutil.which("uv") (main):   None
_uv_executable() (this PR):  <home>/.local/bin/uv

A retry that failed with the same message also left Settings unchanged, so it looked like nothing happened. The job file now records finished_at when an attempt ends, Settings shows "Last attempt: " under the failure, and opening the install prompt for a retry hides the old failure.

Live before and after in Settings > About > More engines, main (ff50be5258) vs this PR, with two real vLLM installs started from the UI on each side and uv in neither PATH nor ~/.local/bin:

Install prompt opened for a retry

A retry that fails the same way

In the load dialog the install prompt opens on its own after a failure, so the old error still shows next to it there, and "Last attempt" shows a time without a date. Both can be fixed separately.

@oobabooga
oobabooga merged commit 6a82e7c into unslothai:main Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] user-level install of uv not found by "more engines" installation; uv not found message never clears and can't be discerned as repeated message

2 participants