Skip to content

[CI] Fix deepspeed astral's cu128 index incompatible with Torch 2.9 - #65936

Merged
elliot-barn merged 1 commit into
ray-project:masterfrom
pseudo-rnd-thoughts:fix-deepspeed-install
Sep 4, 2026
Merged

elliot-barn merged 1 commit into
ray-project:masterfrom
pseudo-rnd-thoughts:fix-deepspeed-install

Conversation

@pseudo-rnd-thoughts

Copy link
Copy Markdown
Member

Description

#65899 added astral's cu128 index for torch-scatter support, however, at the same time, started pulling in a DeepSpeed wheel that was compiled with torch 2.11
This wheel is incompatible with our torch 2.9 install causing

RuntimeError: PyTorch version mismatch! DeepSpeed ops were compiled and installed with a different version than what is being used at runtime. Please re-install DeepSpeed or switch torch versions. Install torch version=2.11, Runtime torch version=2.9 

This PR fixes it through adding --no-binary to uv for deepspeed to ensure that deepspeed is built locally using the current torch version. In this future this could be removed.

@pseudo-rnd-thoughts
pseudo-rnd-thoughts requested a review from a team as a code owner September 4, 2026 16:31
@pseudo-rnd-thoughts pseudo-rnd-thoughts added go add ONLY when ready to merge, run all tests ci labels Sep 4, 2026

@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 the --no-binary deepspeed flag to the uv pip install commands in both docgpu.build.Dockerfile and ml.build.Dockerfile to avoid incompatible prebuilt wheels. However, because uv defaults to build isolation when installing from source, DeepSpeed's setup script will fail to find PyTorch. To prevent this build failure, you should append the --no-build-isolation flag to both commands so that the pre-installed PyTorch from the base image is utilized.

uv pip install -r /home/ray/python_depset.lock --no-deps --system --index-strategy unsafe-best-match
# --no-binary deepspeed: the GPU locks resolve against Astral's cu128 index, which publishes prebuilt deepspeed wheels
# as local versions (0.18.9+cu.12.8.torch.2.11), however, currently we use torch 2.9 which is incompatible
uv pip install -r /home/ray/python_depset.lock --no-deps --system --index-strategy unsafe-best-match --no-binary deepspeed

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.

high

When installing deepspeed from source using --no-binary, uv defaults to build isolation. Since DeepSpeed's setup.py imports torch during the build, this will fail with ModuleNotFoundError because torch is not present in the isolated build environment. Adding --no-build-isolation forces uv to use the pre-installed PyTorch from the base image.

uv pip install -r /home/ray/python_depset.lock --no-deps --system --index-strategy unsafe-best-match --no-binary deepspeed --no-build-isolation

uv pip install -r /home/ray/python_depset.lock --no-deps --system --index-strategy unsafe-best-match
# --no-binary deepspeed: the GPU locks resolve against Astral's cu128 index, which publishes prebuilt deepspeed wheels
# as local versions (0.18.9+cu.12.8.torch.2.11), however, currently we use torch 2.9 which is incompatible
uv pip install -r /home/ray/python_depset.lock --no-deps --system --index-strategy unsafe-best-match --no-binary deepspeed

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.

high

When installing deepspeed from source using --no-binary, uv defaults to build isolation. Since DeepSpeed's setup.py imports torch during the build, this will fail with ModuleNotFoundError because torch is not present in the isolated build environment. Adding --no-build-isolation forces uv to use the pre-installed PyTorch from the base image.

uv pip install -r /home/ray/python_depset.lock --no-deps --system --index-strategy unsafe-best-match --no-binary deepspeed --no-build-isolation

@elliot-barn
elliot-barn merged commit 5753a8d into ray-project:master Sep 4, 2026
4 of 5 checks passed
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ay-project#65936)

## Description
ray-project#65899 added astral's cu128 index
for torch-scatter support, however, at the same time, started pulling in
a DeepSpeed wheel that was compiled with torch 2.11
This wheel is incompatible with our torch 2.9 install causing
```
RuntimeError: PyTorch version mismatch! DeepSpeed ops were compiled and installed with a different version than what is being used at runtime. Please re-install DeepSpeed or switch torch versions. Install torch version=2.11, Runtime torch version=2.9 
```

This PR fixes it through adding `--no-binary` to `uv` for `deepspeed` to
ensure that deepspeed is built locally using the current torch version.
In this future this could be removed.

Signed-off-by: Mark Towers <[email protected]>
Co-authored-by: Mark Towers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci 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