Repository navigation
Conversation
Fedora ships /etc/uv/uv.toml with python-downloads = "manual", so the installer-pinned uv will not fetch a matching interpreter on its own. Fedora 44 system Python is 3.14, which the existing <3.14 / !=3.13.8 bound rejects. If uv venv fails with that hint, run `uv python install` for the same request and retry. Fixes unslothai#9329 Co-authored-by: GokayAI <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR updates the Linux installer’s uv venv flow to recover from distros (e.g., Fedora) that ship /etc/uv/uv.toml with python-downloads = "manual", by detecting the specific uv hint and then explicitly running uv python install <request> before retrying uv venv.
Changes:
- Add
_uv_venv_requestedhelper to retry venv creation after installing a managed Python when uv reports downloads are set tomanual. - Route both “create venv” and “recreate venv” call sites through the new helper (non-macOS-arm64 path).
- Add/extend shell + Python tests to cover the Fedora hint recovery, non-hint failures, and Studio error-clear behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| install.sh | Adds _uv_venv_requested and switches create/recreate venv to use it for Fedora python-downloads=manual recovery. |
| tests/sh/test_linux_uv_python_downloads_manual.sh | New test covering Fedora-hint fallback behavior, call-site routing, and Studio ERROR_CLEAR. |
| tests/sh/test_install_python_guard.sh | Updates helper extraction to include _uv_venv_requested. |
| tests/test_studio_install_workspace_guard.py | Updates marker assertion to track the new helper call site. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| _raw_recreate=$(grep -c '_run_uv_venv "recreate venv"' "$INSTALL_SH" || true) | ||
| assert_eq "no leftover raw _run_uv_venv recreate venv" "0" "$_raw_recreate" | ||
|
|
||
| if grep -E 'UV_PYTHON_DOWNLOADS=automatic|UV_NO_CONFIG=1' "$INSTALL_SH" | grep -q '_uv_venv_requested\|python install'; then |
There was a problem hiding this comment.
Fixed in f3a2e02: the assertion is grep -qE with an ERE alternation now, so it keeps checking under BSD grep.
| _uvvr_out=$(mktemp) || return 1 | ||
| _uvvr_err=$(mktemp) || { rm -f "$_uvvr_out"; return 1; } | ||
| if _run_uv_venv "$_uvvr_label" "$VENV_DIR" --python "$_uvvr_req" \ | ||
| >"$_uvvr_out" 2>"$_uvvr_err"; then | ||
| _uvvr_status=0 | ||
| else | ||
| _uvvr_status=$? | ||
| fi | ||
| cat "$_uvvr_out" | ||
| cat "$_uvvr_err" >&2 |
There was a problem hiding this comment.
Fixed in f3a2e02: the capture is a tee through two FIFOs, so stdout and stderr keep flowing (and stay separate, which install.rs relies on to pair its ERROR_CLEAR twins) while uv venv runs. tests/sh/test_linux_uv_python_downloads_manual.sh asserts OUTPUT_CLEAR is visible while the venv command is still running.
|
Confirmed install.sh still calls _run_uv_venv directly for both create and recreate, so the manual-downloads hint is never acted on, and the retry here is the right direction. The buffering into temp files holds back the [TAURI:*] markers until venv creation ends, so could you tee the streams instead of redirecting them and keep the helper otherwise as-is? |
Hold [TAURI:*] in temp files until uv venv returns, and a recovered Fedora fallback looks idle. mkfifo + tee copies stdout/stderr as they arrive; hint detection, uv python install, and the retry are unchanged. Co-authored-by: GokayAI <[email protected]>
|
Teed the streams so |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f3a2e0213a
ℹ️ 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".
| _uvvr_req="$(_python_request "$PYTHON_VERSION")" | ||
| # Tee, don't redirect-and-replay: Studio consumes [TAURI:*] as they arrive, | ||
| # and holding them until uv venv exits makes a recovered fallback look idle. | ||
| _uvvr_dir=$(mktemp -d "${TMPDIR:-/tmp}/unsloth-uv-venv.XXXXXX") || return 1 |
There was a problem hiding this comment.
Register the venv capture directory for trap cleanup
When the installer receives HUP, INT, or TERM after this mktemp succeeds, _on_install_signal calls _cleanup_install_temporaries, but that cleanup does not know about _uvvr_dir; control therefore never reaches any of this helper's normal rm -rf paths. Cancelling venv creation consequently leaves an unsloth-uv-venv.* directory containing the FIFOs and captured output in the user's temporary directory, so this path should be initialized and removed by the global cleanup logic.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e1b6394. The capture directory is _UV_VENV_CAPTURE_DIR now, initialized with the other installer temporaries before the traps are installed and removed by _cleanup_install_temporaries, so a signal during venv creation no longer leaves unsloth-uv-venv.* with its FIFOs in TMPDIR. The new test sends TERM while uv venv is running, under sh and bash, and asserts the case TMPDIR is empty afterwards; against f3a2e02 it reports the leftover directory.
| clean) return 0 ;; | ||
| fedora) | ||
| if [ "$_uvvr_n" -eq 1 ]; then | ||
| echo "'"$_FEDORA_HINT"'" >&2 |
There was a problem hiding this comment.
Preserve the Fedora hint literally in the test shell
When this Fedora branch runs, interpolating _FEDORA_HINT directly into the sh -c program leaves its backticks active, so the nested shell performs command substitution on uv python install >=3.13, !=3.13.8, <3.14. The range is then parsed as shell redirections: the test emits cannot open 3.14 and leaves an untracked empty =3.13, file in its working directory, while its loose assertions still report success. Quote or pass the hint as data so running this test does not execute its example command or dirty the checkout.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 65d497b. Reproduced first: the suite left an empty file named '=3.13,' in the working directory and printed 'cannot open 3.14', while the assertions still passed because the substring the helper greps for survives the substitution. The hint now reaches the nested shell through the environment, so its backticks stay data, and there is an assertion that the backticked example command arrives verbatim, which fails on f3a2e02.
|
Pushed two follow-ups to this branch.
It also corrects the comment above the helper. An env var prefixed on one command is exactly as narrow as this fallback, so that was not the reason to avoid it. The reason that holds is
Verification on One thing left as is: the second guard, |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
The red |
c7280d5 to
65d497b
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Thanks @gokay-ai. I reproduced the Fedora 44 |
Summary
Studio AppImage first-run on Fedora 44 fails at “Creating virtual environment” because the distro ships
/etc/uv/uv.tomlwithpython-downloads = "manual". The installer-pinned uv still reads that file. Fedora 44’s system Python is 3.14, which the existing<3.14, !=3.13.8bound rejects, so there is no matching interpreter and uv refuses to download one.What changed
Added
_uv_venv_requested, next to the existing_uv_venv_arm64helper:uv venv --python "$(_python_request …)".manual, runuv python installwith the same request (the command Fedora already prints) and retryuv venv.[TAURI:ERROR_CLEAR]the same wayrun_install_cmd/_uv_venv_arm64already do, so Studio does not keep showing “Installation failed” after the retry succeeds.What this does not do
UV_PYTHON_DOWNLOADS=automaticorUV_NO_CONFIG=1for the Linux venv path.<3.14/!=3.13.8Python bound.Test plan
tests/sh/test_linux_uv_python_downloads_manual.sh(undershandbash): clean host, Fedora-like hint, unrelated failure,uv python installfailure, call-site routing, StudioERROR_CLEAR.tests/sh/test_macos_venv_python_preference.sh— arm64 helper still green.tests/sh/test_install_python_guard.sh— skipped-interpreter recreate still restores on failure.Fixes #9329