Skip to content

[ci] Install data CI depset after conda ffmpeg to fix removed packages - #65334

Merged
elliot-barn merged 2 commits into
masterfrom
elliot-barn/data-image-depset-install-last
Aug 10, 2026
Merged

elliot-barn merged 2 commits into
masterfrom
elliot-barn/data-image-depset-install-last

Conversation

@elliot-barn

Copy link
Copy Markdown
Collaborator

Why are these changes needed?

All data17build-py3.10-based CI jobs (data arrow v17 shards, docs example, integration, dashboard) are currently red on master and premerge with:

import pytest → from exceptiongroup import BaseExceptionGroup
ModuleNotFoundError: No module named 'exceptiongroup'

e.g. master postmerge build 19099 and premerge build 71680.

Root cause: in ci/docker/data.build.Dockerfile, the depset lock is installed before conda install -y -c conda-forge "ffmpeg=7.*". With the current oss-ci-base_ml base image (which ships conda 26.7.0), the ffmpeg solve upgrades core native libs (libmamba 2.0.8 → 2.9.0, libarchive, libcurl, fmt), and since no conda 26.x py3.10 build is compatible with that upgraded stack, the solver downgrades conda 26.7.0 → 23.9.0 and removes conda 26's entire python dependency tree — including exceptiongroup, jinja2, markupsafe, httpx and typing-inspection (visible under "The following packages will be REMOVED" in the wanda data17build-py3.10 job log). exceptiongroup is a hard runtime dep of pytest on Python < 3.11, so every pytest target import-fails.

Fix: move the uv pip install -r python_depset.lock step (and the pyarrow-nightly override) after the conda ffmpeg step, so uv restores everything the lock declares. All five data depset locks contain the removed packages (exceptiongroup with a python_full_version < '3.11' marker, so py3.12 images are unaffected by design).

Not a duplicate: searched open PRs for exceptiongroup, ffmpeg conda, and data image/depset changes — no existing PR addresses this.

Related issue number

N/A — master CI breakage, no issue filed.

Checks

  • Verification: this is a CI image build-order change; validated by triaging the wanda data17build-py3.10 build logs (conda removal transaction) and confirming the removed packages are present in all python/deplocks/ci/data-* locks. The premerge data jobs on this PR rebuild the image and are the end-to-end test.
  • pre-commit hooks ran and passed on commit.
  • AI assistance (Claude Code) was used for triage and this change; reviewed line-by-line by the submitter.

🤖 Generated with Claude Code

The conda solve for ffmpeg=7 in the data CI image build downgrades conda
(26.7.0 -> 23.9.0 with the current oss-ci-base_ml base image) and removes
its dependency stack from the miniforge env, including exceptiongroup,
jinja2, markupsafe, httpx and typing-inspection. exceptiongroup is a hard
runtime dependency of pytest on Python < 3.11, so every pytest target in
data17build-py3.10 based jobs fails at import time.

Install the python depset lock after the conda step so uv restores
everything the lock declares.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
@elliot-barn
elliot-barn requested a review from a team as a code owner August 10, 2026 17:02

@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 moves the installation of the Python dependency lock and the nightly pyarrow package to run after the Conda FFmpeg installation in the Dockerfile, ensuring that Conda's dependency resolution does not downgrade or remove required Python packages. The reviewer suggested a cache optimization to split the RUN block and defer the COPY of the lockfile, preventing frequent lockfile updates from invalidating the cache for the slow MongoDB and FFmpeg installation steps.

Comment on lines +37 to +50
# The conda solve above can remove or downgrade python packages in the
# miniforge env (e.g. exceptiongroup, jinja2) while satisfying ffmpeg's
# constraints, so the depset must be installed after it to keep the env
# matching the lock.
uv pip install -r /home/ray/python_depset.lock --no-deps --system --index-strategy unsafe-best-match

if [[ "$IMAGE_TYPE" == "pyarrow-nightly" ]]; then
uv pip install \
--system \
--prerelease allow \
--extra-index-url https://pypi.fury.io/arrow-nightlies/ \
--upgrade-package pyarrow \
pyarrow
fi

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

Cache Optimization: Split RUN block and defer COPY

Currently, COPY $PYTHON_DEPSET /home/ray/python_depset.lock is executed at line 11, before the large RUN block that installs MongoDB and FFmpeg via Conda. Because of this, any change to the Python dependency lockfile (which happens frequently) invalidates the Docker build cache for these slow installation steps.

By splitting the RUN block and moving the COPY instruction right before the uv pip install step, we can ensure that changes to the Python lockfile do not trigger a rebuild of the MongoDB and Conda FFmpeg layers, significantly speeding up CI image builds.

Note: Please also remove the COPY $PYTHON_DEPSET /home/ray/python_depset.lock instruction at line 11 of the Dockerfile to avoid redundant copying and cache invalidation.

EOF

COPY $PYTHON_DEPSET /home/ray/python_depset.lock

RUN <<EOF
#!/bin/bash
set -ex

# The conda solve above can remove or downgrade python packages in the
# miniforge env (e.g. exceptiongroup, jinja2) while satisfying ffmpeg's
# constraints, so the depset must be installed after it to keep the env
# matching the lock.
uv pip install -r /home/ray/python_depset.lock --no-deps --system --index-strategy unsafe-best-match

if [[ "$IMAGE_TYPE" == "pyarrow-nightly" ]]; then
  uv pip install \
    --system \
    --prerelease allow \
    --extra-index-url https://pypi.fury.io/arrow-nightlies/ \
    --upgrade-package pyarrow \
    pyarrow
fi

@andrewsykim andrewsykim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fix.

Seems like the culprit was #63821 which was merged about a month ago. Do we know why it only started to fail recently?

@andrewsykim

Copy link
Copy Markdown
Member

fixes #65323

@elliot-barn elliot-barn added the go add ONLY when ready to merge, run all tests label Aug 10, 2026
…removals

The conda ffmpeg solve can delete files of packages whose dist-info still
matches the lock: when the base image build replaced a version-mismatched
conda package with the pip copy (e.g. conda msgpack-python 1.2.1 -> pip
msgpack 1.1.2), conda-meta keeps a stale entry, and removing it deletes
pip's files while the dist-info survives. uv --no-deps then skips the
package even though its files are gone, breaking import ray in
datamongobuild (microcheck 51856). --reinstall makes uv lay down every
locked package unconditionally. TODO left to isolate ffmpeg in its own
conda env so the solve cannot touch base site-packages at all.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
@elliot-barn

Copy link
Copy Markdown
Collaborator Author

Second commit adds --reinstall to the depset install. Reordering alone wasn't sufficient: microcheck 51856 showed datamongobuild-py3.10 still failing import ray on missing msgpack.

Mechanism: conda and pip share site-packages but keep independent ledgers. During the base_ml build, uv replaced version-mismatched conda copies (conda msgpack-python 1.2.1 → pip msgpack 1.1.2), leaving a stale conda-meta entry. The ffmpeg solve later removed msgpack-python per that stale record — deleting pip's files while pip's dist-info survived — so a plain uv pip install --no-deps skipped the package as already-installed. --reinstall lays down every locked package unconditionally, so the env physically matches the lock regardless of what the conda solve did.

Also noteworthy: the ffmpeg solve is non-deterministic across builds — in the same microcheck run, datalbuild (built ~2s earlier from the same base) got a clean solve that kept conda 26.7.0 and removed nothing, while datamongobuild got the destructive downgrade. A TODO is left in the Dockerfile to move ffmpeg into a dedicated conda env so the solve can't touch base site-packages at all.

@elliot-barn

Copy link
Copy Markdown
Collaborator Author

Thanks for the fix.

Seems like the culprit was #63821 which was merged about a month ago. Do we know why it only started to fail recently?

Here are the events (claude generated)
Date: May 16, 2026
Event: conda-forge changes the conda package to hard-depend on its plugin suite (conda-pypi, conda-self,
conda-rattler-solver, conda-lockfiles) — conda-feedstock#293
(conda-forge/conda-feedstock#293). This attaches a large pure-Python dependency tree (httpx,
anyio, exceptiongroup, jinja2, pydantic, distro…) to conda itself.
────────────────────────────────────────
Date: Jul 15, 2026
Event: The offending PR: #63821 (#63821) (read_lerobot
datasource) adds conda install -y -c conda-forge "ffmpeg=7.*" to ci/docker/data.build.Dockerfile — running a live,
unpinned conda solve inside the same miniforge env the pip depset locks manage, after the depset install. Works fine
at the time.
────────────────────────────────────────
Date: Aug 3, 2026
Event: conda-forge releases conda 26.7.0 (conda-feedstock#310
(conda-forge/conda-feedstock#310)). Ray's base images pick it up automatically because
ci/env/install-miniforge.sh:116 does an unpinned conda install python=3.10 during the base build, which re-resolves
conda to whatever is newest that day. Base images built after this date carry conda 26.7.0 + the full plugin
dependency tree as conda-managed packages sitting in the same site-packages as the pip locks.
────────────────────────────────────────
Date: Aug 7, 2026
Event: conda-forge publishes the new libmamba 2.9.0 stack (with fmt 12, libarchive 3.8.9, simdjson 4.6.6). This
unlocks
a new solution for conda install ffmpeg=7: the newest ffmpeg build needs the new libxml2-16 packaging, which
conflicts with the installed libmamba 2.0.8 pins — and the solver can now resolve this by downgrading conda 26.7.0 →
23.9.0 and removing ~41 packages, including exceptiongroup (hard runtime dep of pytest on py<3.11).
────────────────────────────────────────
Date: Aug 8, 2026
Event: Master postmerge still green (build 19071) — but only because the data images were wanda cache hits; no fresh
conda solve ran.
────────────────────────────────────────
Date: Aug 10, 2026 ~00:48
Event: First fresh data-image rebuild after the drift (premerge 71680 on Andrew's PR, then postmerge 19081/19099 on
master). The destructive solve fires: conda deletes exceptiongroup/jinja2/etc., every pytest target in
data17/datal/datamongo-based jobs fails at import pytest. Master-blocking.

@ray-gardener ray-gardener Bot added the devprod label Aug 10, 2026
@elliot-barn
elliot-barn merged commit 4283d39 into master Aug 10, 2026
6 checks passed
@elliot-barn
elliot-barn deleted the elliot-barn/data-image-depset-install-last branch August 10, 2026 19:32
elliot-barn added a commit that referenced this pull request Aug 10, 2026
…o fix removed packages (#65334) (#65341)

Cherry-pick of #65334 (master commit
4283d39) onto `releases/2.58.0`.

## Why are these changes needed?

Same as #65334: `data17build-py3.10`-based CI jobs (data arrow v17
shards, docs example, integration, dashboard) fail with
`ModuleNotFoundError: No module named 'exceptiongroup'` because the
conda ffmpeg install step removes packages from the data CI depset. The
release branch carries the same Dockerfile ordering, so its data CI is
subject to the same breakage — this keeps 2.58.0 release CI green.

## Notes

- Clean cherry-pick, no conflicts (`git cherry-pick -x -s`); diff is
identical to the master commit (1 file, +22/−11).
- No existing open PR cherry-picks #65334 to this branch (checked via
`gh pr list --search`).
- Original change and this cherry-pick were AI-assisted (Claude Code);
submitted and reviewed by @elliot-barn.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Artimislyy pushed a commit to Artimislyy/ray that referenced this pull request Aug 11, 2026
ray-project#65334)

## Why are these changes needed?

All `data17build-py3.10`-based CI jobs (data arrow v17 shards, docs
example, integration, dashboard) are currently red on master and
premerge with:

```
import pytest → from exceptiongroup import BaseExceptionGroup
ModuleNotFoundError: No module named 'exceptiongroup'
```

e.g. master postmerge [build
19099](https://buildkite.com/ray-project/postmerge/builds/19099) and
premerge [build
71680](https://buildkite.com/ray-project/premerge/builds/71680).

Root cause: in `ci/docker/data.build.Dockerfile`, the depset lock is
installed **before** `conda install -y -c conda-forge "ffmpeg=7.*"`.
With the current `oss-ci-base_ml` base image (which ships conda 26.7.0),
the ffmpeg solve upgrades core native libs (libmamba 2.0.8 → 2.9.0,
libarchive, libcurl, fmt), and since no conda 26.x py3.10 build is
compatible with that upgraded stack, the solver **downgrades conda
26.7.0 → 23.9.0 and removes conda 26's entire python dependency tree** —
including `exceptiongroup`, `jinja2`, `markupsafe`, `httpx` and
`typing-inspection` (visible under "The following packages will be
REMOVED" in the wanda `data17build-py3.10` job log). `exceptiongroup` is
a hard runtime dep of pytest on Python < 3.11, so every pytest target
import-fails.

Fix: move the `uv pip install -r python_depset.lock` step (and the
pyarrow-nightly override) **after** the conda ffmpeg step, so uv
restores everything the lock declares. All five data depset locks
contain the removed packages (`exceptiongroup` with a
`python_full_version < '3.11'` marker, so py3.12 images are unaffected
by design).

Not a duplicate: searched open PRs for `exceptiongroup`, `ffmpeg conda`,
and data image/depset changes — no existing PR addresses this.

## Related issue number

N/A — master CI breakage, no issue filed.

## Checks

- Verification: this is a CI image build-order change; validated by
triaging the wanda `data17build-py3.10` build logs (conda removal
transaction) and confirming the removed packages are present in all
`python/deplocks/ci/data-*` locks. The premerge data jobs on this PR
rebuild the image and are the end-to-end test.
- `pre-commit` hooks ran and passed on commit.
- AI assistance (Claude Code) was used for triage and this change;
reviewed line-by-line by the submitter.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
ray-project#65334)

## Why are these changes needed?

All `data17build-py3.10`-based CI jobs (data arrow v17 shards, docs
example, integration, dashboard) are currently red on master and
premerge with:

```
import pytest → from exceptiongroup import BaseExceptionGroup
ModuleNotFoundError: No module named 'exceptiongroup'
```

e.g. master postmerge [build
19099](https://buildkite.com/ray-project/postmerge/builds/19099) and
premerge [build
71680](https://buildkite.com/ray-project/premerge/builds/71680).

Root cause: in `ci/docker/data.build.Dockerfile`, the depset lock is
installed **before** `conda install -y -c conda-forge "ffmpeg=7.*"`.
With the current `oss-ci-base_ml` base image (which ships conda 26.7.0),
the ffmpeg solve upgrades core native libs (libmamba 2.0.8 → 2.9.0,
libarchive, libcurl, fmt), and since no conda 26.x py3.10 build is
compatible with that upgraded stack, the solver **downgrades conda
26.7.0 → 23.9.0 and removes conda 26's entire python dependency tree** —
including `exceptiongroup`, `jinja2`, `markupsafe`, `httpx` and
`typing-inspection` (visible under "The following packages will be
REMOVED" in the wanda `data17build-py3.10` job log). `exceptiongroup` is
a hard runtime dep of pytest on Python < 3.11, so every pytest target
import-fails.

Fix: move the `uv pip install -r python_depset.lock` step (and the
pyarrow-nightly override) **after** the conda ffmpeg step, so uv
restores everything the lock declares. All five data depset locks
contain the removed packages (`exceptiongroup` with a
`python_full_version < '3.11'` marker, so py3.12 images are unaffected
by design).

Not a duplicate: searched open PRs for `exceptiongroup`, `ffmpeg conda`,
and data image/depset changes — no existing PR addresses this.

## Related issue number

N/A — master CI breakage, no issue filed.

## Checks

- Verification: this is a CI image build-order change; validated by
triaging the wanda `data17build-py3.10` build logs (conda removal
transaction) and confirming the removed packages are present in all
`python/deplocks/ci/data-*` locks. The premerge data jobs on this PR
rebuild the image and are the end-to-end test.
- `pre-commit` hooks ran and passed on commit.
- AI assistance (Claude Code) was used for triage and this change;
reviewed line-by-line by the submitter.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Signed-off-by: 400Ping <[email protected]>
elliot-barn added a commit that referenced this pull request Oct 1, 2026
…moved packages (#65334) (#66619)

## Why are these changes needed?

Cherry-pick of #65334 onto `releases/2.57.1`.

Data CI jobs built on the `data17build-py3.10` image (arrow v17 shards,
doc, integration and dashboard tests) fail on this branch with:

```
import pytest -> from exceptiongroup import BaseExceptionGroup
ModuleNotFoundError: No module named 'exceptiongroup'
```

`ci/docker/data.build.Dockerfile` installs the depset lock before `conda
install ffmpeg=7.*`, and the ffmpeg solve removes conda's python
dependencies (`exceptiongroup`, `jinja2`, `markupsafe`, `httpx`). #65334
installs the lock after the ffmpeg step, with `--reinstall`, so the env
matches the lock again.

The fix is already on master, `releases/2.58.0`, `releases/2.58.1` and
`releases/2.59.0`. `releases/2.57.1` is the only active release branch
still missing it. The rayturbo `releases-2.57.1` merge build hits it:
https://buildkite.com/anyscale/rayturbo/builds/14415

The cherry-pick applied cleanly with no conflicts.

## Related issue number

N/A. Cherry-pick of #65334.

## Checks

- [x] I've signed off every commit (DCO).
- The premerge data jobs on this PR rebuild the image and are the
end-to-end test.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
ray-project#65334)

## Why are these changes needed?

All `data17build-py3.10`-based CI jobs (data arrow v17 shards, docs
example, integration, dashboard) are currently red on master and
premerge with:

```
import pytest → from exceptiongroup import BaseExceptionGroup
ModuleNotFoundError: No module named 'exceptiongroup'
```

e.g. master postmerge [build
19099](https://buildkite.com/ray-project/postmerge/builds/19099) and
premerge [build
71680](https://buildkite.com/ray-project/premerge/builds/71680).

Root cause: in `ci/docker/data.build.Dockerfile`, the depset lock is
installed **before** `conda install -y -c conda-forge "ffmpeg=7.*"`.
With the current `oss-ci-base_ml` base image (which ships conda 26.7.0),
the ffmpeg solve upgrades core native libs (libmamba 2.0.8 → 2.9.0,
libarchive, libcurl, fmt), and since no conda 26.x py3.10 build is
compatible with that upgraded stack, the solver **downgrades conda
26.7.0 → 23.9.0 and removes conda 26's entire python dependency tree** —
including `exceptiongroup`, `jinja2`, `markupsafe`, `httpx` and
`typing-inspection` (visible under "The following packages will be
REMOVED" in the wanda `data17build-py3.10` job log). `exceptiongroup` is
a hard runtime dep of pytest on Python < 3.11, so every pytest target
import-fails.

Fix: move the `uv pip install -r python_depset.lock` step (and the
pyarrow-nightly override) **after** the conda ffmpeg step, so uv
restores everything the lock declares. All five data depset locks
contain the removed packages (`exceptiongroup` with a
`python_full_version < '3.11'` marker, so py3.12 images are unaffected
by design).

Not a duplicate: searched open PRs for `exceptiongroup`, `ffmpeg conda`,
and data image/depset changes — no existing PR addresses this.

## Related issue number

N/A — master CI breakage, no issue filed.

## Checks

- Verification: this is a CI image build-order change; validated by
triaging the wanda `data17build-py3.10` build logs (conda removal
transaction) and confirming the removed packages are present in all
`python/deplocks/ci/data-*` locks. The premerge data jobs on this PR
rebuild the image and are the end-to-end test.
- `pre-commit` hooks ran and passed on commit.
- AI assistance (Claude Code) was used for triage and this change;
reviewed line-by-line by the submitter.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

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

Labels

devprod go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants