Skip to content

[Docs][Core] Warn against setting py_executable to a bare uv run - #67281

Merged
dstrodtman merged 2 commits into
masterfrom
djs-261022-uv-bare-py-executable
Oct 23, 2026
Merged

dstrodtman merged 2 commits into
masterfrom
djs-261022-uv-bare-py-executable

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Description

Adds a caution to the uv run section of the runtime environments page: don't set py_executable to a bare uv run to enable the uv integration. When the driver is launched with uv run, Ray sets py_executable itself. A bare uv run starts workers in whatever environment uv resolves from the worker's starting directory, and if that environment lacks Ray, workers crash on startup and jobs hang without a clear error.

@martinlhw, this is a docs-only alternative to #66191, which you're assigned to. Your question on that PR, whether bare uv run always fails, turned out to be the deciding one: it doesn't. Results on Ray 2.59.0 with uv 0.11.14, macOS, local cluster:

Setup Result
Plain python driver outside any uv project, py_executable="uv run" Workers crash with ModuleNotFoundError: No module named 'ray'; ray.get times out
Plain python driver inside a uv project that depends on Ray Works
Driver launched with uv run Works, because the uv hook overwrites py_executable
JobSubmissionClient.submit_job with py_executable="uv run", cluster started inside a uv project SUCCEEDED, with and without working_dir
Same submission, cluster started outside a uv project Stuck in PENDING (reproduces #54275)

Because the bare value works in some setups, rejecting it with a ValueError as #66191 does would break working configurations, including per-task runtime_env usage that the uv hook never rewrites. The failure is also the same one any py_executable pointing at a Python without Ray produces, so a string match on uv run covers only one case of it. A docs caution addresses what the issue reporter asked for at minimum, "noting in the docs specifically that py_executable shouldn't be provided." If Core wants a runtime guard too, a warning rather than an error seems like the safer shape, and it can land separately.

Related issues

Addresses #54275. Supersedes #66191, which conflicts with master: its local:// changes landed separately in #65245, and the page it edits moved to MyST in #66461.

Additional information

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman dstrodtman added docs An issue or change related to documentation core Issues that should be addressed in Ray Core labels Oct 22, 2026
@dstrodtman
dstrodtman requested a review from martinlhw October 22, 2026 15:10
@dstrodtman
dstrodtman requested review from a team as code owners October 22, 2026 15:10

@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 adds a caution note to the documentation warning users against setting py_executable to a bare uv run when using the uv integration, explaining that it can cause workers to crash. The review feedback suggests refining the wording of this warning for better clarity, precision, and a more professional tone, providing a concrete code suggestion.

Comment on lines +353 to +355
:::{caution}
Don't set `py_executable` to a bare `uv run` to enable the uv integration. When you launch the driver with `uv run`, Ray sets `py_executable` for you. A bare `uv run` starts workers in whatever environment uv resolves from the directory the worker starts in. If that environment doesn't include Ray, workers crash on startup. Jobs then stay pending without a clear error, and their logs might not load.
:::

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

To improve the clarity, precision, and professional tone of the documentation, we can make a few minor adjustments:

  1. Use more formal phrasing (e.g., "Do not" instead of "Don't", "remain pending" instead of "stay pending").
  2. Clarify "the directory the worker starts in" to "the worker's working directory" for technical precision.
  3. Use backticks around uv for consistency when referring to the tool/command environment resolution.
Suggested change
:::{caution}
Don't set `py_executable` to a bare `uv run` to enable the uv integration. When you launch the driver with `uv run`, Ray sets `py_executable` for you. A bare `uv run` starts workers in whatever environment uv resolves from the directory the worker starts in. If that environment doesn't include Ray, workers crash on startup. Jobs then stay pending without a clear error, and their logs might not load.
:::
:::{caution}
Do not set `py_executable` to a bare `uv run` to enable the `uv` integration. When you launch the driver with `uv run`, Ray automatically sets `py_executable` for you. A bare `uv run` starts workers in whatever environment `uv` resolves from the worker's working directory. If that environment does not include Ray, workers will crash on startup. Jobs then remain pending without a clear error, and their logs might not load.
:::

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Applied part of this in 2352a44: reworded the "starts workers in ... the worker starts in" clause, and widened "Jobs" to "Tasks and jobs," since a plain driver's tasks hang too. I kept the contractions, present tense, and "stay"/"hang" wording, per Ray's writing-style guide (doc/source/ray-contribute/writing-style.md: always use contractions, avoid "will"). I also kept "uv" without backticks to match the rest of the page, and avoided "working directory" so readers don't confuse it with the working_dir field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman dstrodtman added the go add ONLY when ready to merge, run all tests label Oct 22, 2026

@martinlhw martinlhw 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.

Thanks!

@dstrodtman
dstrodtman merged commit 7f1215d into master Oct 23, 2026
7 checks passed
@dstrodtman
dstrodtman deleted the djs-261022-uv-bare-py-executable branch October 23, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants