From 6f17e8341e55f79d3471dc1f6db09d013c6f125a Mon Sep 17 00:00:00 2001 From: Eric Kerfoot Date: Fri, 2 May 2025 15:46:51 +0100 Subject: [PATCH] Restrict PyTorch Version to Below 2.7 Signed-off-by: Eric Kerfoot --- .github/workflows/pythonapp-min.yml | 2 +- .github/workflows/pythonapp.yml | 2 +- docs/requirements.txt | 2 +- pyproject.toml | 4 ++-- requirements.txt | 3 +-- setup.cfg | 3 +-- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pythonapp-min.yml b/.github/workflows/pythonapp-min.yml index afc9f6f6d4..4a068666d4 100644 --- a/.github/workflows/pythonapp-min.yml +++ b/.github/workflows/pythonapp-min.yml @@ -124,7 +124,7 @@ jobs: strategy: fail-fast: false matrix: - pytorch-version: ['2.3.1', '2.4.1', '2.5.1', 'latest'] + pytorch-version: ['2.4.1', '2.5.1', '2.6.0'] # FIXME: add 'latest' back once PyTorch 2.7 issues are resolved timeout-minutes: 40 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 5d6fd06afa..536ae6d18a 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -155,7 +155,7 @@ jobs: # install the latest pytorch for testing # however, "pip install monai*.tar.gz" will build cpp/cuda with an isolated # fresh torch installation according to pyproject.toml - python -m pip install torch>=2.3.0 torchvision + python -m pip install torch>=2.4.1 torchvision - name: Check packages run: | pip uninstall monai diff --git a/docs/requirements.txt b/docs/requirements.txt index b314e10640..924a9af1f9 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ -f https://download.pytorch.org/whl/cpu/torch-2.3.0%2Bcpu-cp39-cp39-linux_x86_64.whl -torch>=2.3.0 +torch>=2.4.1, <2.7.0 pytorch-ignite==0.4.11 numpy>=1.20 itk>=5.2 diff --git a/pyproject.toml b/pyproject.toml index 588d6d22d8..863b0fd2be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,14 +2,14 @@ requires = [ "wheel", "setuptools", - "torch>=2.3.0", + "torch>=2.4.1, <2.7.0", "ninja", "packaging" ] [tool.black] line-length = 120 -target-version = ['py38', 'py39', 'py310'] +target-version = ['py39', 'py310', 'py311', 'py312'] include = '\.pyi?$' exclude = ''' ( diff --git a/requirements.txt b/requirements.txt index ad394ce807..903ce0ce00 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ -torch>=2.3.0; sys_platform != 'win32' -torch>=2.4.1; sys_platform == 'win32' +torch>=2.4.1, <2.7.0 numpy>=1.24,<3.0 diff --git a/setup.cfg b/setup.cfg index 622e24abe9..0067ab5f40 100644 --- a/setup.cfg +++ b/setup.cfg @@ -42,8 +42,7 @@ setup_requires = ninja packaging install_requires = - torch>=2.3.0; sys_platform != 'win32' - torch>=2.4.1; sys_platform == 'win32' + torch>=2.4.1, <2.7.0 numpy>=1.24,<3.0 [options.extras_require]