fix: update Dockerfile and requirements-dev.txt for MONAI 1.6 tutorial compatibility#8912
fix: update Dockerfile and requirements-dev.txt for MONAI 1.6 tutorial compatibility#8912garciadias wants to merge 7 commits into
Conversation
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>
📝 WalkthroughWalkthroughUpdates the MONAI Docker build environment from PyTorch 24.10 to 25.03, rewrites pip constraints to enforce Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
Dockerfilerequirements-dev.txt
| && 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" |
There was a problem hiding this comment.
🧩 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.txtRepository: 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.txtRepository: 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.txtRepository: 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
doneRepository: 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}' DockerfileRepository: 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.
Summary
nvcr.io/nvidia/pytorch:24.10-py3to25.03-py3to support RTX 5090 (Blackwell, SM_120/CUDA 12.8); remove the now-obsoletetorch.patchONNX revert which was specific to 24.10mlflow<3.0— mlflow 3.x is broken on Python 3.12 due to a relative import inmlflow.utils.uv_utils(from .. import zippfails at top-level scope); this caused 4 tutorial notebooks to fail in our CI runtransformers<5.0— transformers 5.x referencestorch.float8_e8m0fnuwhich does not exist in the nv25.03 build of PyTorch 2.7; this caused the HuggingFace tutorial to failaimandlightning>=2.0as declared dependencies inrequirements-dev.txt(were previously undeclared but required by tutorial notebooks)numpy==1.26.4(nv25.03 PyTorch compiled against NumPy 1.x) and addsetuptools<71(newer setuptools droppedpkg_resourcesneeded by legacysetup.pyin git-sourced packages like MetricsReloaded and segment-anything)python_version <= '3.10'caps fromcucim,onnxruntime, andtransformers— these restrictions were keeping packages out of the Python 3.12 image unnecessarilypapermill,jupytext,autopep8,autoflake, andipywidgetsdirectly in the Dockerfile so the tutorial runner is self-containedContext
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
Test plan
docker build -t monai_1_6:latest .bash run_our_only.sh 2>&1 | tee runner_output_v2.logsinside the containerhugging_face/hugging_face_pipeline_for_monai.ipynbpasses (R3)experiment_management/spleen_segmentation_aim.ipynbpasses (R6)🤖 Generated with Claude Code