Skip to content

Fix uv_runtime_env_hook.py to pin worker Python version#59768

Merged
edoakes merged 3 commits intoray-project:masterfrom
dlwh:fix_uv_python_version
Jan 21, 2026
Merged

Fix uv_runtime_env_hook.py to pin worker Python version#59768
edoakes merged 3 commits intoray-project:masterfrom
dlwh:fix_uv_python_version

Conversation

@dlwh
Copy link
Contributor

@dlwh dlwh commented Dec 30, 2025

Description

Fix uv_runtime_env_hook.py to pin worker Python version to driver version.

If the system python version is different from the driver python version, you can end up with a mismatch between python versions (e.g. driver 3.11 vs worker 3.12), which causes Ray to deliberately crash elsewhere.

This change ensures compatibility between the Ray driver and the worker by specifying the Python version, preventing version mismatches.

Related issues

Fixes #59639.

Additional information

Copy link
Contributor

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

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 addresses a potential Python version mismatch between the Ray driver and workers when using uv run. The fix correctly pins the worker's Python version by adding the --python argument to the uv run command. The logic for determining the Python version to use is sound, with a clear order of precedence that prioritizes user-specified settings and falls back to the driver's Python version. This effectively prevents version conflicts and related crashes. My review includes one minor suggestion to use a more idiomatic and slightly more performant way to extend a list in Python.

@ray-gardener ray-gardener bot added core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Dec 31, 2025
@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Jan 2, 2026
@edoakes
Copy link
Collaborator

edoakes commented Jan 2, 2026

@dlwh please sign off the commits to fix DCO check

… run`.

This change ensures compatibility between the Ray driver and the worker by specifying the Python version, preventing version mismatches.

Related issue: ray-project#59639.

Signed-off-by: David Hall <david.hall@openathena.ai>
@dlwh dlwh force-pushed the fix_uv_python_version branch from 90a9d0d to b0fa438 Compare January 5, 2026 06:06
@dlwh
Copy link
Contributor Author

dlwh commented Jan 5, 2026

done sorry!

Signed-off-by: David Hall <david.hall@openathena.ai>
@edoakes
Copy link
Collaborator

edoakes commented Jan 6, 2026

Signed-off-by: David Hall <david.hall@openathena.ai>
@dlwh dlwh force-pushed the fix_uv_python_version branch from af98368 to 4be663a Compare January 6, 2026 18:17
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Jan 21, 2026
@edoakes edoakes merged commit 00b2f0d into ray-project:master Jan 21, 2026
6 checks passed
jinbum-kim pushed a commit to jinbum-kim/ray that referenced this pull request Jan 29, 2026
…t#59768)

## Description

Fix `uv_runtime_env_hook.py` to pin worker Python version to driver
version.

If the system python version is different from the driver python
version, you can end up with a mismatch between python versions (e.g.
driver 3.11 vs worker 3.12), which causes Ray to deliberately crash
elsewhere.

This change ensures compatibility between the Ray driver and the worker
by specifying the Python version, preventing version mismatches.

## Related issues

Fixes ray-project#59639.

## Additional information

---------

Signed-off-by: David Hall <david.hall@openathena.ai>
Signed-off-by: jinbum-kim <jinbum9958@gmail.com>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Feb 1, 2026
…t#59768)

## Description

Fix `uv_runtime_env_hook.py` to pin worker Python version to driver
version.

If the system python version is different from the driver python
version, you can end up with a mismatch between python versions (e.g.
driver 3.11 vs worker 3.12), which causes Ray to deliberately crash
elsewhere.

This change ensures compatibility between the Ray driver and the worker
by specifying the Python version, preventing version mismatches.

## Related issues

Fixes ray-project#59639.

## Additional information

---------

Signed-off-by: David Hall <david.hall@openathena.ai>
Signed-off-by: 400Ping <jiekaichang@apache.org>
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Feb 3, 2026
…t#59768)

## Description

Fix `uv_runtime_env_hook.py` to pin worker Python version to driver
version.

If the system python version is different from the driver python
version, you can end up with a mismatch between python versions (e.g.
driver 3.11 vs worker 3.12), which causes Ray to deliberately crash
elsewhere.

This change ensures compatibility between the Ray driver and the worker
by specifying the Python version, preventing version mismatches.

## Related issues

Fixes ray-project#59639.

## Additional information

---------

Signed-off-by: David Hall <david.hall@openathena.ai>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…t#59768)

## Description

Fix `uv_runtime_env_hook.py` to pin worker Python version to driver
version.

If the system python version is different from the driver python
version, you can end up with a mismatch between python versions (e.g.
driver 3.11 vs worker 3.12), which causes Ray to deliberately crash
elsewhere.

This change ensures compatibility between the Ray driver and the worker
by specifying the Python version, preventing version mismatches.

## Related issues

Fixes ray-project#59639.

## Additional information

---------

Signed-off-by: David Hall <david.hall@openathena.ai>
Signed-off-by: peterxcli <peterxcli@gmail.com>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…t#59768)

## Description

Fix `uv_runtime_env_hook.py` to pin worker Python version to driver
version.

If the system python version is different from the driver python
version, you can end up with a mismatch between python versions (e.g.
driver 3.11 vs worker 3.12), which causes Ray to deliberately crash
elsewhere.

This change ensures compatibility between the Ray driver and the worker
by specifying the Python version, preventing version mismatches.

## Related issues

Fixes ray-project#59639.

## Additional information

---------

Signed-off-by: David Hall <david.hall@openathena.ai>
Signed-off-by: peterxcli <peterxcli@gmail.com>
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 go add ONLY when ready to merge, run all tests stale The issue is stale. It will be closed within 7 days unless there are further conversation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core] uv run runtime_env hook can start workers on a different Python than the driver, causing “Version mismatch” failures

2 participants