Skip to content

fix: update Dockerfile and requirements-dev.txt for MONAI 1.6 tutorial compatibility#8912

Open
garciadias wants to merge 7 commits into
Project-MONAI:devfrom
garciadias:fix/monai_1_6_release_notebooks
Open

fix: update Dockerfile and requirements-dev.txt for MONAI 1.6 tutorial compatibility#8912
garciadias wants to merge 7 commits into
Project-MONAI:devfrom
garciadias:fix/monai_1_6_release_notebooks

Conversation

@garciadias

Copy link
Copy Markdown
Collaborator

Summary

  • Rebase Docker image from nvcr.io/nvidia/pytorch:24.10-py3 to 25.03-py3 to support RTX 5090 (Blackwell, SM_120/CUDA 12.8); remove the now-obsolete torch.patch ONNX revert which was specific to 24.10
  • Pin mlflow<3.0 — mlflow 3.x is broken on Python 3.12 due to a relative import in mlflow.utils.uv_utils (from .. import zipp fails at top-level scope); this caused 4 tutorial notebooks to fail in our CI run
  • Pin transformers<5.0 — transformers 5.x references torch.float8_e8m0fnu which does not exist in the nv25.03 build of PyTorch 2.7; this caused the HuggingFace tutorial to fail
  • Add aim and lightning>=2.0 as declared dependencies in requirements-dev.txt (were previously undeclared but required by tutorial notebooks)
  • Rebuild the NVIDIA pip constraint file to retain numpy==1.26.4 (nv25.03 PyTorch compiled against NumPy 1.x) and add setuptools<71 (newer setuptools dropped pkg_resources needed by legacy setup.py in git-sourced packages like MetricsReloaded and segment-anything)
  • Remove python_version <= '3.10' caps from cucim, onnxruntime, and transformers — these restrictions were keeping packages out of the Python 3.12 image unnecessarily
  • Install papermill, jupytext, autopep8, autoflake, and ipywidgets directly in the Dockerfile so the tutorial runner is self-contained

Context

These changes were identified by running the full MONAI tutorial test suite in a fresh Docker build against a MONAI 1.6 dev branch and comparing results with a native conda reference run (Eric's run, eccefc57). The rerun with stderr captured (runner_output_our_only.logs) confirmed the specific error for each notebook group.

Type of change

  • Bug fix
  • Feature
  • Hotfix
  • Spike / exploration
  • Documentation
  • Refactor

Test plan

  • Rebuild Docker image with docker build -t monai_1_6:latest .
  • Re-run bash run_our_only.sh 2>&1 | tee runner_output_v2.logs inside the container
  • Verify mlflow notebooks pass (R1: 4 notebooks)
  • Verify hugging_face/hugging_face_pipeline_for_monai.ipynb passes (R3)
  • Verify experiment_management/spleen_segmentation_aim.ipynb passes (R6)

🤖 Generated with Claude Code

garciadias and others added 7 commits February 5, 2025 15:34
Signed-off-by: R. Garcia-Dias <rafaelagd@gmail.com>
…l compatibility

Rebase from nvcr.io/nvidia/pytorch:24.10-py3 to 25.03-py3 (RTX 5090 / SM_120 support).
Pin mlflow<3.0 (3.x broken on Python 3.12) and transformers<5.0 (5.x references
torch.float8_e8m0fnu absent in nv25.03 PyTorch). Add aim and lightning>=2.0 as
declared dependencies. Remove Python 3.10 version caps from cucim and onnxruntime.
Rebuild pip constraint file to keep numpy==1.26.4 and add setuptools<71.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Updates the MONAI Docker build environment from PyTorch 24.10 to 25.03, rewrites pip constraints to enforce setuptools<71, bumps Python dependencies including transformers (≥4.41.0,<5.0), mlflow (<3.0), and adds aim and lightning>=2.0. Removes the torch/onnx patch step and makes onnxruntime unconditional across Python versions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly summarizes the main change: updating Docker and requirements for MONAI 1.6 tutorial compatibility.
Description check ✅ Passed The description covers all required template sections with detailed explanations of changes, rationale, and testing plan.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch fix/monai_1_6_release_notebooks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Dockerfile`:
- Around line 44-46: The Dockerfile currently re-specifies mlflow and
transformers in the extra pip install line, creating a conflicting second source
of truth; remove the "mlflow<3.0" and "transformers<5.0" entries from the python
-m pip install line that also installs
papermill/jupytext/autopep8/autoflake/ipywidgets so that mlflow and transformers
are only resolved from requirements-dev.txt (which pins >=2.12.2,<3.0 and
>=4.41.0,<5.0 respectively); keep the separate install for the other tools
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1a02d9ae-23fb-489b-b718-130352617025

📥 Commits

Reviewing files that changed from the base of the PR and between eccefc5 and 9a5bfeb.

📒 Files selected for processing (2)
  • Dockerfile
  • requirements-dev.txt

Comment thread Dockerfile
Comment on lines +44 to +46
&& python -m pip install --no-cache-dir -r /tmp/requirements-dev.txt \
&& python -m pip install --no-cache-dir papermill jupytext autopep8 autoflake ipywidgets \
&& python -m pip install --no-cache-dir "mlflow<3.0" "transformers<5.0" "aim" "lightning>=2.0"

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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Dockerfile explicit dependency installs:"
rg -n 'pip install.*(papermill|jupytext|autopep8|autoflake|ipywidgets|mlflow|transformers|aim|lightning)' Dockerfile -C1

echo
echo "requirements-dev.txt dependency declarations:"
rg -n '^(papermill|jupytext|autopep8|autoflake|ipywidgets|mlflow|transformers|aim|lightning)\b' requirements-dev.txt

Repository: Project-MONAI/MONAI

Length of output: 771


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n '^(papermill|jupytext|autopep8|autoflake|ipywidgets|aim|lightning)\b' requirements-dev.txt

Repository: Project-MONAI/MONAI

Length of output: 216


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n '^(papermill|jupytext|autopep8|autoflake|ipywidgets|mlflow|transformers)\b' requirements-dev.txt

Repository: Project-MONAI/MONAI

Length of output: 254


🏁 Script executed:

#!/bin/bash
set -euo pipefail

for p in papermill jupytext autopep8 autoflake ipywidgets mlflow transformers; do
  echo "== $p =="
  rg -n "\b${p}\b" requirements-dev.txt || true
done

Repository: Project-MONAI/MONAI

Length of output: 365


🏁 Script executed:

#!/bin/bash
set -euo pipefail

nl -ba Dockerfile | sed -n '30,70p'

Repository: Project-MONAI/MONAI

Length of output: 106


🏁 Script executed:

#!/bin/bash
set -euo pipefail

awk 'NR>=30 && NR<=70 {printf "%4d:%s\n", NR, $0}' Dockerfile

Repository: Project-MONAI/MONAI

Length of output: 2552


Unify mlflow/transformers pins in Dockerfile (Line 44-46).

requirements-dev.txt already pins mlflow (>=2.12.2,<3.0) and transformers (>=4.41.0,<5.0), but the Dockerfile adds weaker second-install constraints (mlflow<3.0, transformers<5.0), dropping the lower bounds and creating a second source of truth. Keep the separate installs for papermill/jupytext/autopep8/autoflake/ipywidgets (not declared in requirements-dev.txt), and align/remove the extra mlflow/transformers specifiers to match requirements-dev.txt only.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` around lines 44 - 46, The Dockerfile currently re-specifies
mlflow and transformers in the extra pip install line, creating a conflicting
second source of truth; remove the "mlflow<3.0" and "transformers<5.0" entries
from the python -m pip install line that also installs
papermill/jupytext/autopep8/autoflake/ipywidgets so that mlflow and transformers
are only resolved from requirements-dev.txt (which pins >=2.12.2,<3.0 and
>=4.41.0,<5.0 respectively); keep the separate install for the other tools
unchanged.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant