Skip to content

Fix bare 'uv run' py_executable causing unloadable logs - #65788

Closed
lorenzozanee wants to merge 1 commit into
ray-project:masterfrom
lorenzozanee:fix/uv-run-py-executable-handling
Closed

lorenzozanee wants to merge 1 commit into
ray-project:masterfrom
lorenzozanee:fix/uv-run-py-executable-handling

Conversation

@lorenzozanee

Copy link
Copy Markdown

Description

Since Ray 2.47 the uv integration is automatic when the driver is launched with uv run; the hook now sets py_executable to uv run --python X.Y.Z python automatically. The legacy value py_executable='uv run' lacks a Python interpreter and causes workers to fail to start with unloadable runtime_env/worker logs. This PR rejects the bare value at validation time with a clear error directing users to remove py_executable.

Related issues

Fixes #54275

Additional information

Docs updated to state that py_executable should not be set manually for uv.

Since Ray 2.47 uv integration is automatic when the driver
is launched with `uv run` (hook sets py_executable to
`uv run --python X.Y.Z python` automatically). The legacy
value `py_executable='uv run'` lacks a Python interpreter and
causes worker startup failures with unloadable runtime_env/
worker logs and an ambiguous dashboard error. Validate
`py_executable` early and reject bare `uv run` (including
path-prefixed variants) with a clear ValueError directing
users to remove `py_executable`; jobs succeed without it.
Also documents that `py_executable` should not be set for uv.

Signed-off-by: lorenzozanee <[email protected]>
@lorenzozanee
lorenzozanee requested review from a team as code owners August 29, 2026 19:01

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces validation for the 'py_executable' field in 'runtime_env' to deprecate and reject the bare 'uv run' command, which is now handled automatically since Ray 2.47. It also updates the documentation to guide users on this change. The review feedback points out that the path-matching logic for 'uv.exe' on Windows fails when absolute paths are used, and suggests a more robust, platform-agnostic approach to extract the executable name.

Comment on lines +453 to +458
first == "uv"
or first.endswith("/uv")
or first.endswith("\\uv")
or first == "uv.exe"
)
if is_uv and second == "run":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The current check for uv.exe only matches when first == "uv.exe". If a Windows user specifies an absolute path to uv.exe (e.g., C:\Users\Username\AppData\Local\Programs\uv\uv.exe run), first will be C:\Users\Username\AppData\Local\Programs\uv\uv.exe, which does not match first == "uv.exe", nor does it end with \uv or /uv. This allows the deprecated bare uv run command to bypass validation on Windows, leading to worker startup failures.

Using a platform-agnostic check like first.replace("\\", "/").split("/")[-1] in ("uv", "uv.exe") is more robust and handles absolute/relative paths on all platforms.

        is_uv = first.replace("\\", "/").split("/")[-1] in ("uv", "uv.exe")

@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Aug 29, 2026
@MengjinYan

Copy link
Copy Markdown
Contributor

@pcmoritz Can you help with reviewing the PR? Thanks!

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

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core docs An issue or change related to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core] - providing py_executable=uv run causes failures with unloadable logs

3 participants