Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
env:
# minimum supported version of Python
PYTHON_VER1: '3.10'
PYTHON_VER1: '3.11'
# force installation of CPU-only PyTorch
PIP_EXTRA_INDEX_URL: 'https://download.pytorch.org/whl/cpu'
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ concurrency:
# Supported versions of Python and PyTorch are listed here for use below and as documentation
env:
# supported versions of Python
PYTHON_VER1: '3.10'
PYTHON_VER2: '3.11'
PYTHON_VER3: '3.12'
PYTHON_VER4: '3.13'
# PYTHON_VER5: '3.14' # TODO: not compatible with Torchscript, re-enable once Torchscript removed from MONAI
PYTHON_VER1: '3.11'
PYTHON_VER2: '3.12'
PYTHON_VER3: '3.13'
PYTHON_VER4: '3.14'
# PYTHON_VER5: '3.15' # TODO: not compatible with Torchscript, re-enable once Torchscript removed from MONAI
# supported versions of PyTorch
PYTORCH_VER1: '2.8.0'
PYTORCH_VER2: '2.9.1'
PYTORCH_VER3: '2.10.0'
PYTORCH_VER4: '2.11.0'
TORCHVISION_VER1: '0.23.0' # used for testing with lowest PyTorch version (PYTORCH_VER1), update as needed
PYTORCH_VER1: '2.12.1'
PYTORCH_VER2: '2.13.0'
PYTORCH_VER3: '2.14.1'
PYTORCH_VER4: '2.15.0'
TORCHVISION_VER1: '0.27.1' # used for testing with lowest PyTorch version (PYTORCH_VER1), update as needed

# versions of PyTorch/Torchvision to use for full-dep Windows tests, needed to get around a gloo bug
WIN_FULLDEP_VER: '2.11.0'
WIN_FULLDEP_VISION_VER: '0.26.0'
TQDM_DISABLE: 1 # squelch TQDM output to reduce log file size

PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python # https://github.com/Project-MONAI/MONAI/issues/4354

# These jobs run the CICD tests, type checking, and testing packaging. These use the minimum supported versions of
PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" # forces CPU PyTorch installation, should be faster

# These jobs run the CI tests, type checking, and testing packaging. These use the minimum supported versions of
# Python and PyTorch in many places using the above environment variables but also hard coded where necessary.
# When support is dropped for a version it is important to update these as appropriate.

Expand Down Expand Up @@ -133,33 +133,35 @@ jobs:
# Base test cases are to test on all three OSes with the lowest versions of Python and PyTorch, other cases are
# added below as special cases to cover other Python and PyTorch versions under Ubuntu
os: [windows-latest, macOS-latest, ubuntu-latest]
python-version: ['3.10']
pytorch-version: ['2.8.0']
python-version: ['3.11']
pytorch-version: ['2.12.1']
include:
# Test Python versions under Ubuntu with lowest PyTorch version supported
- os: ubuntu-latest
pytorch-version: '2.8.0'
python-version: '3.11'
- os: ubuntu-latest
pytorch-version: '2.8.0'
pytorch-version: '2.12.1'
python-version: '3.12'
- os: ubuntu-latest
pytorch-version: '2.8.0'
pytorch-version: '2.12.1'
python-version: '3.13'
# - os: ubuntu-latest
# pytorch-version: '2.9.1'
# python-version: '3.14'
- os: ubuntu-latest
pytorch-version: '2.12.1'
python-version: '3.14'

# Test PyTorch versions under Ubuntu with lowest Python version supported
- os: ubuntu-latest
python-version: '3.10'
pytorch-version: '2.9.1'
python-version: '3.11'
pytorch-version: '2.13.0'
- os: ubuntu-latest
python-version: '3.11'
pytorch-version: '2.14.1'
- os: ubuntu-latest
python-version: '3.10'
pytorch-version: '2.10.0'
python-version: '3.11'
pytorch-version: '2.15.0'
Comment thread
ericspod marked this conversation as resolved.
Resolved

# Test newer Python with latest PyTorch under Ubuntu
- os: ubuntu-latest
python-version: '3.10'
pytorch-version: '2.11.0'
python-version: '3.12'
pytorch-version: '2.15.0'

timeout-minutes: 40
steps:
Expand Down Expand Up @@ -245,13 +247,8 @@ jobs:
run: |
which python
python -m pip install --upgrade pip wheel
- if: runner.os == 'windows' && needs.test_skip.outputs.skip == 0
name: Install torch cpu from pytorch.org (Windows only)
run: |
python -m pip install torch==${WIN_FULLDEP_VER} torchvision==${WIN_FULLDEP_VISION_VER}+cpu --index-url https://download.pytorch.org/whl/cpu
shell: bash
- if: runner.os != 'windows' && needs.test_skip.outputs.skip == 0
name: Install torch gpu
- if: needs.test_skip.outputs.skip == 0
name: Install PyTorch
run: |
# install the lowest version of PyTorch supported
python -m pip install torch==${PYTORCH_VER1} torchvision==${TORCHVISION_VER1}
Expand Down Expand Up @@ -324,7 +321,7 @@ jobs:
python -m pip install --upgrade pip wheel tomli pytest
# need a specific version of torch for nvsubquadratic
python monai/config/print_dependencies.py build-system | \
xargs -d '\n' pip install --no-build-isolation torch==2.10.0 torchvision==0.25.0
xargs -d '\n' pip install --no-build-isolation
# # nvsubquadratic runtime imports need only torch + einops + omegaconf; install
# # the package itself without its core dependency tree (see job comment above).
python -m pip install --no-build-isolation omegaconf
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11"]
python-version: ["3.11", "3.12"]
runs-on: ${{ matrix.os }}
timeout-minutes: 46 # equal to max + 3*std over the last 600 successful runs
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cron-ngc-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.11'
cache: pip
- name: Install CPU PyTorch
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
with:
ref: dev
fetch-depth: 0
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.11'
- shell: bash
run: |
git describe
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonapp-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:

if [ ${{ matrix.environment }} = "PT230+CUDA124" ]
then
PYVER=3.10 PYSFX=3 DISTUTILS=python3-distutils && \
PYVER=3.11 PYSFX=3 DISTUTILS=python3-distutils && \
apt-get update && apt-get install -y --no-install-recommends \
curl \
pkg-config \
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
python-version: ['3.11', '3.12', '3.13', '3.14', '3.15']
steps:
- uses: actions/checkout@v7
with:
Expand Down Expand Up @@ -67,22 +67,22 @@ jobs:
env:
QUICKTEST: True

- if: matrix.python-version == '3.10' && startsWith(github.ref, 'refs/tags/')
- if: matrix.python-version == '3.11' && startsWith(github.ref, 'refs/tags/')
name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/

- if: matrix.python-version == '3.10' && startsWith(github.ref, 'refs/tags/')
- if: matrix.python-version == '3.11' && startsWith(github.ref, 'refs/tags/')
name: Check artifacts
run: |
ls -al dist/
rm dist/monai*.tar.gz
ls -al dist/

# remove publishing to Test PyPI as it is moved to blossom
# - if: matrix.python-version == '3.10' && startsWith(github.ref, 'refs/tags/')
# - if: matrix.python-version == '3.11' && startsWith(github.ref, 'refs/tags/')
# name: Publish to Test PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
Expand All @@ -100,10 +100,10 @@ jobs:
# full history so that we can git describe
with:
fetch-depth: 0
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.11'
- shell: bash
run: |
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/setupapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: ['3.10', '3.11', '3.12']
# python-version: ['3.11', '3.12']
# steps:
# - uses: actions/checkout@v7
# with:
Expand Down Expand Up @@ -136,10 +136,10 @@ jobs:
install: # pip install from github url, the default branch is dev
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.11'
- name: Install CPU PyTorch
run: |
python -m pip install torch==2.8.0 torchvision --extra-index-url https://download.pytorch.org/whl/cpu
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/weekly-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ on:


env:
PYTHON_VER: '3.10'
PYTORCH_VER: '2.8.0'
PYTHON_VER: '3.11'
PYTORCH_VER: '2.12.1'
PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" # forces CPU PyTorch installation, should be faster

jobs:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,5 @@ runs
*.pth

*zarr/*

uv.lock
2 changes: 1 addition & 1 deletion docs/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.10"
python: "3.11"
sphinx:
configuration: docs/source/conf.py
python:
Expand Down
4 changes: 2 additions & 2 deletions docs/source/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

---

MONAI's core functionality is written in Python 3 (>= 3.10) and only requires [Numpy](https://numpy.org/) and [PyTorch](https://pytorch.org/).
MONAI's core functionality is written in Python 3 (>= 3.11) and only requires [Numpy](https://numpy.org/) and [PyTorch](https://pytorch.org/).

The package is currently distributed via Github as the primary source code repository,
and the Python package index (PyPI). The pre-built Docker images are made available on DockerHub.
Expand Down Expand Up @@ -343,6 +343,6 @@ this will install PyTorch as well as `pytorch-cuda`, please follow https://pytor
```bash
git clone https://github.com/Project-MONAI/MONAI.git
cd MONAI/
conda create -n <name> python=<ver> # eg 3.10
conda create -n <name> python=<ver> # eg 3.11
conda env update -n <name> -f environment-dev.yml
```
2 changes: 1 addition & 1 deletion docs/source/whatsnew_1_6.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- `NumpyReader` has been updated with an `allow_pickle` boolean argument to enable/disable pickle loading from `.npy/.npz` files. This was previously hard-coded to be enabled, but is now defined by this argument and disabled by default. This addresses [GHSA-qxq5-qhx6-94qw](https://github.com/Project-MONAI/MONAI/security/advisories/GHSA-qxq5-qhx6-94qw).


MONAI now tests for Python 3.10 onwards, having dropped version 3.9 which is now out of support. PyTorch 2.8 onwards is now supported only, older versions will likely continue to function.
MONAI now tests for Python 3.11 onwards, having dropped version 3.9 which is now out of support. PyTorch 2.12 onwards is now supported only, older versions will likely continue to function.

## Nested Dot-Notation Access in ConfigParser

Expand Down
2 changes: 1 addition & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: monai
channels:
- defaults
dependencies:
- python>=3.10
- python>=3.11
- pip
- pip:
- -e .[all,testing]
2 changes: 1 addition & 1 deletion monai/apps/auto3dseg/auto_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def set_device_info(
cmd_prefix: command line prefix for subprocess running in BundleAlgo and EnsembleRunner.
Default using env "CMD_PREFIX" or None, examples are:

- single GPU/CPU or multinode bcprun: "python " or "/opt/conda/bin/python3.10",
- single GPU/CPU or multinode bcprun: "python " or "/opt/conda/bin/python3.11",
- single node multi-GPU running "torchrun --nnodes=1 --nproc_per_node=2 "

If user define this prefix, please make sure --nproc_per_node matches cuda_visible_device or
Expand Down
2 changes: 1 addition & 1 deletion monai/auto3dseg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ def _prepare_cmd_default(cmd: str, cmd_prefix: str | None = None, **kwargs: Any)
Args:
cmd: the command or script to run in the distributed job.
cmd_prefix: the command prefix to run the script,
e.g., "python", "python -m", "python3", "/opt/conda/bin/python3.10".
e.g., "python", "python -m", "python3", "/opt/conda/bin/python3.11".
kwargs: the keyword arguments to be passed to the script.

Returns:
Expand Down
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ requires = [
"more-itertools>=8.0",
"ninja",
"packaging",
"torch>=2.8.0",
"torch>=2.12.1",
"numpy>=1.24,<3.0",
"backports.tarfile" # see https://github.com/Project-MONAI/MONAI/issues/8791
]
Expand All @@ -17,7 +17,7 @@ build-backend = "setuptools.build_meta"
name = "monai"
description = "AI Toolkit for Healthcare Imaging"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.10"
requires-python = ">=3.11"
license = { text = "Apache License 2.0" }
authors = [{ name = "MONAI Consortium", email = "monai.contact@gmail.com" }]
classifiers = [
Expand All @@ -27,10 +27,11 @@ classifiers = [
"Intended Audience :: Healthcare Industry",
"Programming Language :: C++",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
Expand All @@ -40,7 +41,7 @@ classifiers = [
"Typing :: Typed",
]
dependencies = [
"torch>=2.8.0",
"torch>=2.12.1",
"numpy>=1.24,<3.0"
]
dynamic = ["version"]
Expand Down Expand Up @@ -78,7 +79,6 @@ all = [
"nvidia-ml-py",
"onnx_graphsurgeon",
"onnx>=1.13.0",
"onnxruntime; python_version <= '3.10'",
"onnxscript",
"openslide-bin",
"openslide-python",
Expand Down Expand Up @@ -141,7 +141,7 @@ nvimgcodec = [
"cupy-cuda13x[ctk]!=14.1.0; platform_system == 'Linux'",
"nvidia-nvimgcodec-cu13[all]>=0.8.0; platform_system == 'Linux'"
]
onnx = ["onnx>=1.13.0", "onnxruntime; python_version <= '3.10'", "onnx_graphsurgeon", "onnxscript"]
onnx = ["onnx>=1.13.0", "onnx_graphsurgeon", "onnxscript"]
openslide = ["openslide-python", "openslide-bin"]
optuna = ["optuna"]
pandas = ["pandas"]
Expand Down Expand Up @@ -395,7 +395,7 @@ project-excludes = [
]

# Match CI environment
python-version = "3.10"
python-version = "3.11"
python-platform = "linux"

# "legacy" preset provides a smooth migration from previous type checkers
Expand Down
Loading