From 396741eec6076a83c3104aa9b73d2f7957201ab7 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Mon, 2 Sep 2024 22:04:34 +0530 Subject: [PATCH] Fix CasADi libs workaround for macOS wheels, update to CasADi 3.6.6 for Windows wheels (#4391) * Fix CasADi libs workaround for macOS wheels * Bump to CasADi 3.6.6 * Update vcpkg baseline for CasADi 3.6.6 update * libc++ is still not fixed * Fix a typo in the build-system table * Fix GHA macOS versions for images * Fix Windows access violation with `msvcp140.dll` --------- Co-authored-by: Eric G. Kratz --- .github/workflows/publish_pypi.yml | 11 ++++++----- pyproject.toml | 6 +++--- vcpkg-configuration.json | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index 7482f03003..9ca277b653 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -84,7 +84,9 @@ jobs: CMAKE_BUILD_PARALLEL_LEVEL=${{ steps.get_num_cores.outputs.count }} CIBW_ARCHS: AMD64 CIBW_BEFORE_BUILD: python -m pip install setuptools wheel delvewheel # skip CasADi and CMake - CIBW_REPAIR_WHEEL_COMMAND: delvewheel repair -w {dest_dir} {wheel} + # Fix access violation because GHA runners have modified PATH that picks wrong + # msvcp140.dll, see https://github.com/adang1345/delvewheel/issues/54 + CIBW_REPAIR_WHEEL_COMMAND: delvewheel repair --add-path C:/Windows/System32 -w {dest_dir} {wheel} CIBW_TEST_EXTRAS: "all,dev,jax" CIBW_TEST_COMMAND: | python -c "import pybamm; print(pybamm.IDAKLUSolver())" @@ -149,9 +151,6 @@ jobs: - name: Clone pybind11 repo (no history) run: git clone --depth 1 --branch v2.12.0 https://github.com/pybind/pybind11.git -c advice.detachedHead=false - - name: Set macOS-specific environment variables - run: echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV - - name: Install cibuildwheel run: python -m pip install cibuildwheel @@ -243,13 +242,15 @@ jobs: python scripts/install_KLU_Sundials.py python -m cibuildwheel --output-dir wheelhouse env: + # 10.13 for Intel (macos-12/macos-13), 11.0 for Apple Silicon (macos-14 and macos-latest) + MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os == 'macos-14' && '11.0' || '10.13' }} CIBW_ARCHS_MACOS: auto CIBW_BEFORE_BUILD: python -m pip install cmake casadi setuptools wheel delocate CIBW_REPAIR_WHEEL_COMMAND: | if [[ $(uname -m) == "x86_64" ]]; then delocate-listdeps {wheel} && delocate-wheel -v -w {dest_dir} {wheel} elif [[ $(uname -m) == "arm64" ]]; then - # Use higher macOS target for now: https://github.com/casadi/casadi/issues/3698 + # Use higher macOS target for now since casadi/libc++.1.0.dylib is still not fixed delocate-listdeps {wheel} && delocate-wheel -v -w {dest_dir} {wheel} --require-target-macos-version 11.1 for file in {dest_dir}/*.whl; do mv "$file" "${file//macosx_11_1/macosx_11_0}"; done fi diff --git a/pyproject.toml b/pyproject.toml index e4cce3eccd..34ccd05e20 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,9 +3,9 @@ requires = [ "setuptools>=64", "wheel", # On Windows, use the CasADi vcpkg registry and CMake bundled from MSVC - "casadi>=3.6.5; platform_system!='Windows'", + "casadi>=3.6.6; platform_system!='Windows'", # Note: the version of CasADi as a build-time dependency should be matched - # cross platforms, so updates to its minimum version here should be accompanied + # across platforms, so updates to its minimum version here should be accompanied # by a version bump in https://github.com/pybamm-team/casadi-vcpkg-registry. "cmake; platform_system!='Windows'", ] @@ -37,7 +37,7 @@ classifiers = [ dependencies = [ "numpy>=1.23.5,<2.0.0", "scipy>=1.11.4", - "casadi>=3.6.5", + "casadi>=3.6.6", "xarray>=2022.6.0", "anytree>=2.8.0", "sympy>=1.12", diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 11505be46e..8d5c64ac47 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -13,7 +13,7 @@ { "kind": "git", "repository": "https://github.com/pybamm-team/casadi-vcpkg-registry.git", - "baseline": "ceee3ed50246744cdef43517d7d7617b8ac291e7", + "baseline": "1cb93f2fb71be26c874db724940ef8e604ee558e", "packages": ["casadi"] } ]