From 8aae724e0c81be0adccc41b1ee391f414f98d9b4 Mon Sep 17 00:00:00 2001 From: Nickolai Belakovski Date: Sun, 16 Jun 2024 14:24:10 -0400 Subject: [PATCH] Trying to fix CI issues - gcc 13.3.0 seems to have an issue with math.h on macOS. It spews a bunch of errors about the API_DEPRECATED macro not being used correctly, which is not an issue on our side. gcc 13.2.0 does not seem to have this issue, but since we cannot select gcc with such granularity we downgrade to gcc 12 and hope this fixes the issue for now. - numpy 2.0.0 has come out which causes runtime issues. Fortunately the fix is easy, just build with pybind11 >=2.12.0. However this is still an issue for the pdfo compatibility test since pdfo does not support numpy 2.0.0, and sometimes the tests install 2.0.0 because it happens to be in the pip cache. So we upgrade pybind11 (the new version is compatible with 2.0 and 1.0 numpy) and skip the pdfo test if we happened to pick up numpy 2. - macOS builds for building Python wheels started to complain when running the "delocate" step that libquadmath, libstdc++, and libgfortran have minimum targets of 11.0, whereas the default was 10.9, hence we added the relevant env variable for CIBW. - Notes have been made in build_python.yml for failures related to Ubuntu 24.04. --- .github/workflows/build_python.yml | 14 +++++++++++++- .github/workflows/cmake.yml | 3 ++- python/pybind11 | 2 +- python/tests/test_compatibility_pdfo.py | 3 +++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_python.yml b/.github/workflows/build_python.yml index a0ecce12f9..c7659673b0 100644 --- a/.github/workflows/build_python.yml +++ b/.github/workflows/build_python.yml @@ -26,7 +26,11 @@ jobs: fail-fast: false matrix: # As of 20240501, macos-11/12/13 are AMD64, and macOS-14 is ARM64. - os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-2019, windows-2022, macos-11, macos-12, macos-13, macos-14] + # As of 20240616, ubuntu 24.04 is fialing to copy files into the quay.io/pypa/manylinux2014_i686:2024-05-13-0983f6f container + # It fails with "tar: ./todo: Cannot utime: Function not implemented" for every file in the repo. + # This is strange since it worked for the quay.io/pypa/manylinux2014_x86_64:2024-05-13-0983f6f container. + # I suggest trying ubuntu-24.04 again in a month. + os: [ubuntu-20.04, ubuntu-22.04, windows-2019, windows-2022, macos-11, macos-12, macos-13, macos-14] steps: - name: Clone Repository (Latest) @@ -46,11 +50,19 @@ jobs: - name: Checkout pybind11 submodule run: git submodule update --init python/pybind11 + - name: Set the MACOSX_DEPLOYMENT_TARGET + if: ${{ runner.os == 'macOS' }} + run: | + MACOSX_DEPLOYMENT_TARGET=$(swvers --productVersion | cut -d'.' -f 1) + echo "MACOSX_DEPLOYMENT_TARGET is $MACOSX_DEPLOYMENT_TARGET" + echo "MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET" >> $GITHUB_ENV + - name: Set up Fortran uses: fortran-lang/setup-fortran@main if: ${{ runner.os == 'macOS' }} with: compiler: gcc + version: 12 # Copied from https://github.com/scipy/scipy/blob/main/.github/workflows/wheels.yml # For rtools, see https://github.com/r-windows/rtools-installer/releases, which has been diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 96c7a59a4c..278e21214d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -42,7 +42,8 @@ jobs: toolchain: - {compiler: gcc, version: 11, cflags: '-Wall -Wextra -Wpedantic -Werror', fflags: '-Wall -Wextra -Wpedantic -Werror -fimplicit-none -fcheck=all -fstack-check -Wno-function-elimination'} - {compiler: gcc, version: 12, cflags: '-Wall -Wextra -Wpedantic -Werror', fflags: '-Wall -Wextra -Wpedantic -Werror -fimplicit-none -fcheck=all -fstack-check -Wno-function-elimination'} - - {compiler: gcc, version: 13, cflags: '-Wall -Wextra -Wpedantic -Werror', fflags: '-Wall -Wextra -Wpedantic -Werror -fimplicit-none -fcheck=all -fstack-check -Wno-function-elimination'} + # As of 20240616 gcc13 has issues importing math.h on macOS. + # - {compiler: gcc, version: 13, cflags: '-Wall -Wextra -Wpedantic -Werror', fflags: '-Wall -Wextra -Wpedantic -Werror -fimplicit-none -fcheck=all -fstack-check -Wno-function-elimination'} - {compiler: intel-classic, version: '2021.8', cflags: '-diag-disable=10441 -Wall -w3 -Werror-all', fflags: '-warn all -debug extended -fimplicit-none -standard-semantics'} - {compiler: intel-classic, version: '2021.9', cflags: '-diag-disable=10441 -Wall -w3 -Werror-all', fflags: '-warn all -debug extended -fimplicit-none -standard-semantics'} - {compiler: intel-classic, version: '2021.10', cflags: '-diag-disable=10441 -Wall -w3 -Werror-all', fflags: '-warn all -debug extended -fimplicit-none -standard-semantics'} diff --git a/python/pybind11 b/python/pybind11 index 8a099e44b3..3e9dfa2866 160000 --- a/python/pybind11 +++ b/python/pybind11 @@ -1 +1 @@ -Subproject commit 8a099e44b3d5f85b20f05828d919d2332a8de841 +Subproject commit 3e9dfa2866941655c56877882565e7577de6fc7b diff --git a/python/tests/test_compatibility_pdfo.py b/python/tests/test_compatibility_pdfo.py index 6eaaaf6cd5..9ecfc90c06 100644 --- a/python/tests/test_compatibility_pdfo.py +++ b/python/tests/test_compatibility_pdfo.py @@ -20,6 +20,9 @@ def test_pdfo(): scipy = pytest.importorskip("scipy") if version.parse(scipy.__version__) < version.parse("1.11.0"): pytest.skip("scipy version too old for this test (its version of COBYLA does not accept bounds)") + numpy = pytest.importorskip("numpy") + if version.parse(numpy.__version__) >= version.parse("2.0.0"): + pytest.skip("numpy version too new for this test (pdfo does not yet support numpy v2)") from pdfo import pdfo from scipy.optimize import NonlinearConstraint as NLC, LinearConstraint as LC, Bounds