From a6c8f3eef566adcb6eff6856bf245fc2a21228be Mon Sep 17 00:00:00 2001 From: "R. Garcia-Dias" Date: Thu, 11 Jun 2026 08:32:24 +0100 Subject: [PATCH 1/3] fix: update Dockerfile and requirements-dev.txt for MONAI 1.6 tutorial compatibility Signed-off-by: R. Garcia-Dias Base image updated to nvcr.io/nvidia/pytorch:25.12-py3 (aligned with upstream dev). Pin mlflow<3.0 (3.x broken on Python 3.12) and transformers<5.0 (5.x references torch.float8_e8m0fnu absent in older PyTorch builds). 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. Add papermill/jupytext/autopep8/autoflake/ipywidgets for tutorial runner. --- Dockerfile | 11 ++++++++++- requirements-dev.txt | 6 ++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e9f005e75e..55b093c7ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,12 +26,21 @@ RUN if [[ $(uname -m) =~ "aarch64" ]]; then \ WORKDIR /opt/monai +# Patch NVIDIA's pip constraint file: +# - keep numpy==1.26.4 pin (PyTorch nv25.12 was compiled against NumPy 1.x) +# - add setuptools<71 (newer setuptools removed pkg_resources needed by legacy setup.py) +# - remove jupytext/isort pins so the tutorial runner can install its required versions +RUN grep '^numpy==' /etc/pip/constraint.txt > /tmp/new_constraints.txt \ + && printf 'setuptools<71\n' >> /tmp/new_constraints.txt \ + && cp /tmp/new_constraints.txt /etc/pip/constraint.txt + # install full deps COPY requirements.txt requirements-min.txt requirements-dev.txt /tmp/ RUN cp /tmp/requirements.txt /tmp/req.bak \ && awk '!/torch/' /tmp/requirements.txt > /tmp/tmp && mv /tmp/tmp /tmp/requirements.txt \ && python -m pip install --upgrade --no-cache-dir --no-build-isolation pip wheel wheel-stub \ - && python -m pip install --no-cache-dir --no-build-isolation -r /tmp/requirements-dev.txt + && python -m pip install --no-cache-dir --no-build-isolation -r /tmp/requirements-dev.txt \ + && python -m pip install --no-cache-dir --no-build-isolation papermill jupytext autopep8 autoflake ipywidgets # compile ext and remove temp files # TODO: remark for issue [revise the dockerfile #1276](https://github.com/Project-MONAI/MONAI/issues/1276) diff --git a/requirements-dev.txt b/requirements-dev.txt index 08fcdc2b0e..4524e3ddf6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -33,9 +33,11 @@ tifffile; platform_system == "Linux" or platform_system == "Darwin" pandas requests einops -transformers>=4.53.0 -mlflow>=2.12.2,<3.13 +transformers>=4.53.0, <5.0 # 5.x references torch.float8_e8m0fnu absent in older PyTorch builds +mlflow>=2.12.2, <3.0 # 3.x broken on Python 3.12 (relative import in mlflow.utils.uv_utils) clearml>=1.10.0rc0 +aim # experiment tracking backend for spleen_segmentation_aim tutorial +lightning>=2.0 # PyTorch Lightning for lightning-based training tutorials matplotlib>=3.6.3 tensorboardX types-PyYAML From bcb47e20ac0b476a4c4615a1a504a3dddfeb591b Mon Sep 17 00:00:00 2001 From: "R. Garcia-Dias" Date: Thu, 11 Jun 2026 14:16:05 +0100 Subject: [PATCH 2/3] fix: pin setuptools<71 in requirements-dev.txt for MetricsReloaded compatibility MetricsReloaded's setup.py imports pkg_resources, which was removed from setuptools>=71. The Dockerfile already constrains this via /etc/pip/constraint.txt, but CI runners (GitHub Actions) have no such constraint and fail with ModuleNotFoundError: No module named 'pkg_resources' during MetricsReloaded build. Signed-off-by: R. Garcia-Dias --- requirements-dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements-dev.txt b/requirements-dev.txt index 4524e3ddf6..47dd0f99d7 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -18,6 +18,7 @@ black>=26.3.1 isort>=5.1, <6, !=6.0.0 ruff>=0.14.11,<0.15 pybind11 +setuptools<71 # pkg_resources removed in setuptools>=71; needed by MetricsReloaded setup.py types-setuptools mypy>=1.5.0, <1.12.0 ninja From 6ed7e10dae8570d39eae4d25e1a00d0ab155645c Mon Sep 17 00:00:00 2001 From: "R. Garcia-Dias" Date: Thu, 11 Jun 2026 14:19:44 +0100 Subject: [PATCH 3/3] fix: restrict aim to Linux in requirements-dev.txt aim's build requires aimrocks (C extension with no Windows wheels), causing metadata-generation-failed on Windows CI runners. aim is only used by the spleen_segmentation_aim tutorial which requires a Linux/GPU environment anyway. Signed-off-by: R. Garcia-Dias --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 47dd0f99d7..81fba00f6a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -37,7 +37,7 @@ einops transformers>=4.53.0, <5.0 # 5.x references torch.float8_e8m0fnu absent in older PyTorch builds mlflow>=2.12.2, <3.0 # 3.x broken on Python 3.12 (relative import in mlflow.utils.uv_utils) clearml>=1.10.0rc0 -aim # experiment tracking backend for spleen_segmentation_aim tutorial +aim; platform_system == "Linux" # experiment tracking backend for spleen_segmentation_aim tutorial lightning>=2.0 # PyTorch Lightning for lightning-based training tutorials matplotlib>=3.6.3 tensorboardX