diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 1d9368b82d..7afb6c7b30 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -50,9 +50,30 @@ jobs: uses: actions/setup-python@v2 with: python-version: '3.8' + + - name: Upgrade pip + run: | + pip install --upgrade pip + pip --version + + - name: Build pymatgen with compatible numpy + run: | + # This step is necessary because certain versions of `pymatgen` will not specify an explicit version of + # `numpy` in its build requirements, and so the latest version will be used. This causes problems, + # however, because this means that the compiled version of `pymatgen` can only be used with that version + # of `numpy` or higher, since `numpy` only guarantees forward compatibility of the ABI. If we want to + # run with an older version of `numpy`, we need to ensure that `pymatgen` is built with that same + # version. This we can accomplish by installing the desired version of `numpy` manually and then calling + # the install command for `pymatgen` with the `--no-build-isolation` flag. This flag will ensure that + # build dependencies are ignored and won't be installed (preventing the most recent version of `numpy` + # to be installed) and the build relies on those requirements already being present in the environment. + # We also need to install `wheel` because otherwise the `pymatgen` build will fail because `bdist_wheel` + # will not be available. + pip install numpy==1.21.4 wheel + pip install pymatgen==2022.0.16 --no-cache-dir --no-build-isolation + - name: Install python dependencies run: | - python -m pip install --upgrade pip pip install -r requirements/requirements-py-3.8.txt pip install --no-deps -e . pip freeze diff --git a/.github/workflows/ci-code.yml b/.github/workflows/ci-code.yml index 65fcc45860..d4517f2226 100644 --- a/.github/workflows/ci-code.yml +++ b/.github/workflows/ci-code.yml @@ -89,11 +89,26 @@ jobs: sudo apt install postgresql graphviz - name: Upgrade pip and setuptools - # It is crucial to update `setuptools` or the installation of `pymatgen` can break run: | - pip install --upgrade pip setuptools + pip install --upgrade pip pip --version + - name: Build pymatgen with compatible numpy + run: | + # This step is necessary because certain versions of `pymatgen` will not specify an explicit version of + # `numpy` in its build requirements, and so the latest version will be used. This causes problems, + # however, because this means that the compiled version of `pymatgen` can only be used with that version + # of `numpy` or higher, since `numpy` only guarantees forward compatibility of the ABI. If we want to + # run with an older version of `numpy`, we need to ensure that `pymatgen` is built with that same + # version. This we can accomplish by installing the desired version of `numpy` manually and then calling + # the install command for `pymatgen` with the `--no-build-isolation` flag. This flag will ensure that + # build dependencies are ignored and won't be installed (preventing the most recent version of `numpy` + # to be installed) and the build relies on those requirements already being present in the environment. + # We also need to install `wheel` because otherwise the `pymatgen` build will fail because `bdist_wheel` + # will not be available. + pip install numpy==1.21.4 wheel + pip install pymatgen==2022.0.16 --no-cache-dir --no-build-isolation + - name: Install aiida-core run: | pip install --use-feature=2020-resolver -r requirements/requirements-py-${{ matrix.python-version }}.txt diff --git a/.github/workflows/rabbitmq.yml b/.github/workflows/rabbitmq.yml index d868ef1629..a3fc311988 100644 --- a/.github/workflows/rabbitmq.yml +++ b/.github/workflows/rabbitmq.yml @@ -56,6 +56,22 @@ jobs: pip install --upgrade pip pip --version + - name: Build pymatgen with compatible numpy + run: | + # This step is necessary because certain versions of `pymatgen` will not specify an explicit version of + # `numpy` in its build requirements, and so the latest version will be used. This causes problems, + # however, because this means that the compiled version of `pymatgen` can only be used with that version + # of `numpy` or higher, since `numpy` only guarantees forward compatibility of the ABI. If we want to + # run with an older version of `numpy`, we need to ensure that `pymatgen` is built with that same + # version. This we can accomplish by installing the desired version of `numpy` manually and then calling + # the install command for `pymatgen` with the `--no-build-isolation` flag. This flag will ensure that + # build dependencies are ignored and won't be installed (preventing the most recent version of `numpy` + # to be installed) and the build relies on those requirements already being present in the environment. + # We also need to install `wheel` because otherwise the `pymatgen` build will fail because `bdist_wheel` + # will not be available. + pip install numpy==1.21.4 wheel + pip install pymatgen==2022.0.16 --no-cache-dir --no-build-isolation + - name: Install aiida-core run: | pip install -r requirements/requirements-py-3.8.txt diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1c95ff1307..05555ef5f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -82,9 +82,30 @@ jobs: run: | sudo apt update sudo apt install postgresql graphviz + + - name: Upgrade pip + run: | + pip install --upgrade pip + pip --version + + - name: Build pymatgen with compatible numpy + run: | + # This step is necessary because certain versions of `pymatgen` will not specify an explicit version of + # `numpy` in its build requirements, and so the latest version will be used. This causes problems, + # however, because this means that the compiled version of `pymatgen` can only be used with that version + # of `numpy` or higher, since `numpy` only guarantees forward compatibility of the ABI. If we want to + # run with an older version of `numpy`, we need to ensure that `pymatgen` is built with that same + # version. This we can accomplish by installing the desired version of `numpy` manually and then calling + # the install command for `pymatgen` with the `--no-build-isolation` flag. This flag will ensure that + # build dependencies are ignored and won't be installed (preventing the most recent version of `numpy` + # to be installed) and the build relies on those requirements already being present in the environment. + # We also need to install `wheel` because otherwise the `pymatgen` build will fail because `bdist_wheel` + # will not be available. + pip install numpy==1.21.4 wheel + pip install pymatgen==2022.0.16 --no-cache-dir --no-build-isolation + - name: Install aiida-core run: | - pip install --upgrade pip setuptools pip install -r requirements/requirements-py-3.8.txt pip install --no-deps -e . - name: Run sub-set of test suite diff --git a/requirements/requirements-py-3.10.txt b/requirements/requirements-py-3.10.txt index 26607edf12..3c507d6f36 100644 --- a/requirements/requirements-py-3.10.txt +++ b/requirements/requirements-py-3.10.txt @@ -76,7 +76,7 @@ nbformat==5.1.3 nest-asyncio==1.4.3 networkx==2.6.3 notebook==6.4.5 -numpy==1.21.4 +numpy==1.22.0 packaging==21.3 palettable==3.3.0 pamqp==2.3.0 @@ -104,7 +104,7 @@ PyCifRW==4.4.3 pycparser==2.21 pydata-sphinx-theme==0.6.3 Pygments==2.10.0 -pymatgen==2022.0.16 +pymatgen==2022.1.9 Pympler==0.9 PyMySQL==0.9.3 PyNaCl==1.4.0 diff --git a/setup.json b/setup.json index 69fb3da726..b4861c103f 100644 --- a/setup.json +++ b/setup.json @@ -86,7 +86,7 @@ "PyCifRW~=4.4", "ase~=3.18", "matplotlib~=3.3,>=3.3.4", - "pymatgen>=2019.7.2,<=2022.02.03,!=2019.9.7", + "pymatgen>=2019.7.2,<=2022.1.9,!=2019.9.7", "pymysql~=0.9.3", "seekpath~=1.9,>=1.9.3", "spglib~=1.14"