From 06f7b2b6ca38b4a4e65976621a82f1f2b3ff1ebb Mon Sep 17 00:00:00 2001 From: Guillaume Fraux Date: Thu, 19 Feb 2026 17:33:29 +0100 Subject: [PATCH] Drop support for PyTorch 2.1 and 2.2 This also means we drop support for intel macOS, since the last wheel on PyPI for it was for torch 2.2 --- .github/workflows/build-wheels.yml | 24 ++----------------- .github/workflows/torch-tests.yml | 2 +- docs/src/installation.rst | 4 ++-- metatomic-torch/CHANGELOG.md | 4 ++++ metatomic-torch/CMakeLists.txt | 2 +- .../metatomic_torch/build-backend/backend.py | 2 +- python/metatomic_torch/setup.py | 2 +- 7 files changed, 12 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index af2305811..8b1ec4432 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -29,25 +29,15 @@ jobs: name: ${{ matrix.name }} (torch v${{ matrix.torch-version }}) strategy: matrix: - os: ['ubuntu-24.04', 'ubuntu-24.04-arm', 'macos-15-intel', 'macos-15', 'windows-2022'] + os: ['ubuntu-24.04', 'ubuntu-24.04-arm', 'macos-15', 'windows-2022'] arch: ['arm64', 'x86_64'] - torch-version: ['2.1', '2.2', '2.3', '2.4', '2.5', '2.6', '2.7', '2.8', '2.9', '2.10'] + torch-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '2.8', '2.9', '2.10'] exclude: # remove mismatched arch-os combinations - - {os: macos-15-intel, arch: arm64} - {os: windows-2022, arch: arm64} - {os: ubuntu-24.04, arch: arm64} - {os: macos-15, arch: x86_64} - {os: ubuntu-24.04-arm, arch: x86_64} - # arch x86_64 on macos is only supported for torch <2.3 - - {os: macos-15-intel, arch: x86_64, torch-version: '2.3'} - - {os: macos-15-intel, arch: x86_64, torch-version: '2.4'} - - {os: macos-15-intel, arch: x86_64, torch-version: '2.5'} - - {os: macos-15-intel, arch: x86_64, torch-version: '2.6'} - - {os: macos-15-intel, arch: x86_64, torch-version: '2.7'} - - {os: macos-15-intel, arch: x86_64, torch-version: '2.8'} - - {os: macos-15-intel, arch: x86_64, torch-version: '2.9'} - - {os: macos-15-intel, arch: x86_64, torch-version: '2.10'} include: # add `cibw-arch` and `rust-target` to the different configurations - name: x86_64 Linux @@ -60,11 +50,6 @@ jobs: arch: arm64 rust-target: aarch64-unknown-linux-gnu cibw-arch: aarch64 - - name: x86_64 macOS - os: macos-15-intel - arch: x86_64 - rust-target: x86_64-apple-darwin - cibw-arch: x86_64 - name: arm64 macOS os: macos-15 arch: arm64 @@ -76,8 +61,6 @@ jobs: rust-target: x86_64-pc-windows-msvc cibw-arch: AMD64 # add the right python version image for each torch version - - {torch-version: '2.1', cibw-python: 'cp311-*'} - - {torch-version: '2.2', cibw-python: 'cp312-*'} - {torch-version: '2.3', cibw-python: 'cp312-*'} - {torch-version: '2.4', cibw-python: 'cp312-*'} - {torch-version: '2.5', cibw-python: 'cp312-*'} @@ -143,9 +126,6 @@ jobs: - name: arm64 Linux os: ubuntu-24.04-arm arch: arm64 - - name: x86_64 macOS - os: macos-15-intel - arch: x86_64 - name: arm64 macOS os: macos-15 arch: arm64 diff --git a/.github/workflows/torch-tests.yml b/.github/workflows/torch-tests.yml index 994b461b7..4aa30a9ae 100644 --- a/.github/workflows/torch-tests.yml +++ b/.github/workflows/torch-tests.yml @@ -19,7 +19,7 @@ jobs: include: - os: ubuntu-24.04 python-version: "3.10" - torch-version: "2.1" + torch-version: "2.3" numpy-version-pin: "<2.0" - os: ubuntu-24.04 python-version: "3.10" diff --git a/docs/src/installation.rst b/docs/src/installation.rst index 8555cf16d..38b0bf219 100644 --- a/docs/src/installation.rst +++ b/docs/src/installation.rst @@ -23,7 +23,7 @@ and use it will depend on the programming language you are using. We provide pre-compiled wheels on PyPI that are compatible with all the supported ``torch`` versions at the time of the ``metatomic-torch`` release. - Currently PyTorch version 2.1 and above is supported. + Currently PyTorch version 2.3 and above is supported. If you want to use the code with an unsupported PyTorch version, or a new release of PyTorch which did not exist yet when we released @@ -105,7 +105,7 @@ and use it will depend on the programming language you are using. metatensor-torch. - the C++ part of PyTorch, which you can install `on its own `_. We are compatible with - ``libtorch`` version 2.1 or above. You can also use the same library as + ``libtorch`` version 2.3 or above. You can also use the same library as the Python version of torch by adding the output of the command below to ``CMAKE_PREFIX_PATH``: diff --git a/metatomic-torch/CHANGELOG.md b/metatomic-torch/CHANGELOG.md index 3c140e92b..9a3dcc773 100644 --- a/metatomic-torch/CHANGELOG.md +++ b/metatomic-torch/CHANGELOG.md @@ -17,6 +17,10 @@ a changelog](https://keepachangelog.com/en/1.1.0/) format. This project follows ### Removed --> +### Changed + +- Removed support for torch 2.1 and 2.2 + ## [Version 0.1.8](https://github.com/metatensor/metatomic/releases/tag/metatomic-torch-v0.1.8) - 2026-02-02 ### Added diff --git a/metatomic-torch/CMakeLists.txt b/metatomic-torch/CMakeLists.txt index 57fd9d465..8f253344d 100644 --- a/metatomic-torch/CMakeLists.txt +++ b/metatomic-torch/CMakeLists.txt @@ -91,7 +91,7 @@ endif() # fixed version in `cmake/FindCUDNN.cmake` set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}") -find_package(Torch 2.1 REQUIRED) +find_package(Torch 2.3 REQUIRED) set(METATOMIC_TORCH_HEADERS "include/metatomic/torch/system.hpp" diff --git a/python/metatomic_torch/build-backend/backend.py b/python/metatomic_torch/build-backend/backend.py index b350ac20e..c762d91e6 100644 --- a/python/metatomic_torch/build-backend/backend.py +++ b/python/metatomic_torch/build-backend/backend.py @@ -11,7 +11,7 @@ if FORCED_TORCH_VERSION is not None: TORCH_DEP = f"torch =={FORCED_TORCH_VERSION}" else: - TORCH_DEP = "torch >=2.1" + TORCH_DEP = "torch >=2.3" # ==================================================================================== # # Build backend functions definition # diff --git a/python/metatomic_torch/setup.py b/python/metatomic_torch/setup.py index 28a2cc55f..defd269f3 100644 --- a/python/metatomic_torch/setup.py +++ b/python/metatomic_torch/setup.py @@ -312,7 +312,7 @@ def create_version_number(version): torch_version = f"== {torch_v_major}.{torch_v_minor}.*" except ImportError: # otherwise we are building a sdist - torch_version = ">= 2.1" + torch_version = ">= 2.3" install_requires = [ f"torch {torch_version}",