From 672eec18eb850252148f95870ead87f69cb0b935 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Mon, 14 Sep 2026 11:50:54 -0500 Subject: [PATCH] Give the Linux wheel verification an MPI to load The Linux leg's import check has never been able to pass for an MPI-linked wheel: ImportError: libmpi.so.40: cannot open shared object file By design the Linux wheel does not vendor MPI -- CIBW_REPAIR_WHEEL_COMMAND_LINUX excludes libmpi/libopen-rte/libopen-pal so it links against the runtime system's OpenMPI, because vendoring is a dead end (auditwheel bundles shared libraries but never the bin/orted that OpenMPI's singleton startup needs). The other half of that contract is that something must supply MPI wherever the wheel is imported, and nothing did: CIBW_BEFORE_ALL_LINUX builds OpenMPI into /usr/local/openmpi inside the manylinux *container*, while "Verify Wheel Installs" runs on the runner host. Installing libopenmpi-dev/openmpi-bin there makes the host resemble the end user's machine the wheel already documents as a requirement. Same packages setup_nwx_dev_env uses, so the ABI matches what CIBW_BEFORE_ALL_LINUX compiled against. macOS is unaffected -- delocate vendors MPI into the wheel there -- which is why the ParallelZone release that surfaced this passed on macos-14 and failed only on Linux. This was masked rather than new: import_check.py arrived in 65681cd, the same commit that introduced the SKBUILD_CMAKE_DEFINE quoting defect fixed in #192. Every build died before reaching verification, so the check had never actually run on Linux. Found by NWChemEx/ParallelZone#161. Co-Authored-By: Claude Opus 5 --- .github/actions/build_pypi_dist/action.yml | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/actions/build_pypi_dist/action.yml b/.github/actions/build_pypi_dist/action.yml index e852104..7a565cc 100644 --- a/.github/actions/build_pypi_dist/action.yml +++ b/.github/actions/build_pypi_dist/action.yml @@ -421,6 +421,34 @@ runs: # Cheap safety net before publishing to a registry where a bad upload # can only be yanked, never truly deleted: catch an unimportable wheel # here rather than after it's live on PyPI. + # The Linux wheel deliberately does NOT vendor MPI: CIBW_REPAIR_WHEEL_COMMAND_LINUX + # excludes libmpi/libopen-rte/libopen-pal so the wheel links against whatever + # OpenMPI is on the runtime system, because vendoring it is a dead end + # (auditwheel bundles shared libraries but never the accompanying bin/orted + # that OpenMPI's singleton startup needs). The flip side of that contract is + # that *something* has to provide MPI wherever such a wheel is imported. + # + # Nothing does, here. CIBW_BEFORE_ALL_LINUX builds OpenMPI into + # /usr/local/openmpi inside the manylinux *container*; the verification below + # runs on the runner host, which has no MPI at all. So importing the freshly + # built wheel fails with + # + # ImportError: libmpi.so.40: cannot open shared object file + # + # Installing it here makes the host look like the end user's machine the + # wheel documents as a requirement. Same packages setup_nwx_dev_env uses, so + # the ABI matches what CIBW_BEFORE_ALL_LINUX compiled against (Ubuntu 24.04 + # ships the OpenMPI 4.1.x that provides libmpi.so.40). + # + # macOS needs none of this: delocate vendors MPI into the wheel there, which + # is why only the Linux leg was affected. + - name: Install Runtime MPI for Verification + if: inputs.cibw_build != '' && inputs.needs_mpi == 'true' && runner.os == 'Linux' + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y libopenmpi-dev openmpi-bin + - name: Verify Wheel Installs shell: bash run: |