-
Notifications
You must be signed in to change notification settings - Fork 293
Description
With the deprecation of the GHA macos-13 runner images, which are the last ones to support Intel Macs, it will become more common for people to try to build x86-64 wheels on macOS arm64. When trying this for NumPy, I found that the before-build, before-test, test-command, etc. hooks are inconsistently wrapped for Rosetta usage (i.e., prepending -arch x86_64`):
before_buildis not wrapped, see macos.py#L451-L454before_testis wrapped, see macos.py#L665-L670test_commandis also wrapped, see macos.py#L732
This is a problem, as a pip install somepkg in before-build may happily succeed while installing an arm64 package, which will cause a problem in next steps by either failing or silently doing the wrong thing. Here is a passing CI job for a numpy cp311-macosx_x86_64 wheel where the before-build phase installs scipy-openblas64 for arm64 which then goes missing from the final wheel (the build linked Accelerate instead).
I'd think that the expected behavior is for before-build and before-test to be wrapped in the same way.
Alternatively, it should be documented that this isn't done. One could then manually work around it and install an x86-64 package like so:
pip install scipy-openblas64 --platform macosx_10_13_x86_64 --only-binary :all: --target $(python -c "import os; print(f'{os.path.dirname(os.__file__)}/site-packages')")