Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ RUN if [[ $(uname -m) =~ "aarch64" ]]; then \

WORKDIR /opt/monai

# Patch NVIDIA's pip constraint file:
# - keep the base image's numpy pin if present (older images pin numpy==1.26.4 as
# their torch was compiled against NumPy 1.x; newer images may ship an empty file)
# - add setuptools<71 (setuptools>=71 removed pkg_resources, breaking MetricsReloaded)
# - pin urllib3>=2 to prevent inadvertent downgrades by pip-installing legacy packages
RUN (grep '^numpy' /etc/pip/constraint.txt || true) > /tmp/new_constraints.txt \

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 looking into the image. Is this RUN needed for the image in general or specifically for the tutorials? If the latter we shouldn't have it perhaps.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The constraint patching is general-purpose rather than tutorial-specific:

  • setuptools<71MetricsReloaded (in requirements-dev.txt) uses a legacy setup.py that imports pkg_resources, which was removed from setuptools>=71. Without this pin the requirements-dev.txt install step fails on any fresh image build.
  • urllib3>=2 — prevents pip install of legacy packages (e.g. bentoml==0.13.1) from downgrading urllib3 to 1.x, which would silently break requests, gdown, huggingface_hub and others already installed by the base image.
  • numpy — just preserves whatever pin the base image ships with (nv25.12 ships an empty constraint file, so this is a no-op there; older base images had numpy==1.26.4 to match their PyTorch build).

I have updated the comment to drop the tutorial-specific bullet and clarify the general-purpose intent.

&& printf 'setuptools<71\nurllib3>=2\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 \
Expand Down
5 changes: 3 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,8 +34,8 @@ 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
matplotlib>=3.6.3
tensorboardX
Expand Down
Loading