BLD: Add support for building iOS wheels - #28759
Conversation
|
Thanks @freakboy3742. This looks pretty clean. The |
|
And update; after discussions on the mesonbuild/meson-python#731, some additional changes to meson (mesonbuild/meson#14541) and CPython (python/cpython#133184) were identified. I'm working on getting those changes upstreamed. |
|
cibuildwheel 3.0 out. :) |
Awesome! A new meson-python release is only remaining blocker. |
bf0802b to
b57ba57
Compare
|
Status update: With the current main branch of meson-python, numpy/meson#22 applied to the meson-python branch, and the current main branch of cibuildwheel, this passes the full test suite on iOS under both Python 3.13 and 3.14. The changes to the test suite changes involve:
On top of those changes, there's one specific change to ctypes handling to account for the odd way that iOS handles dynamic loading, and one workaround for a pytest issue (related to getuser() and the creation of temporary files). |
|
The test changes seem fine to me. |
|
I've added CI workflows, and updated cibuildwheel and vendored-meson versions; the meson-python release is the only outstanding TODO. I've updated the description of the PR to reflect current status, and a couple of notable design decisions. |
| "version with a fix (0.3.33.112) or BLAS metadata is not " | ||
| "sufficient to identify the BLAS implementation." | ||
| ) | ||
| raise |
There was a problem hiding this comment.
This modification isn't iOS specific - I've added it because of this build failure on Android.
(Tagging @mhsmith for visibility)
rgommers
left a comment
There was a problem hiding this comment.
This looks very close, only a few minor things in the diff. The main remaining issue is the CI config: you're adding 6 jobs here, which is fine for testing on this PR, but it's way too much to merge - I already see the CI queue backing up because of the limited macOS runner concurrency. Two points
- There's no need to duplicate testing of the same platform/blas config between
ios.ymlandwheels.yml. The former even invokescibuildwheelanyway, so it looks like a 100% duplication. - I wouldn't test the path with no Accelerate linkage in CI, that's of very limited real-world value and pretty unlikely to regress anyway.
It looks to me like two CI jobs is the way to go here: one for arm64_iphoneos and one for arm64_iphonesimulator. Two wheels.yml entries would cover that, meaning the ios.yml can be removed completely, unless I am missing something here.
|
I've merged with main as of today - and this PR is finally ready for review 🎉 There's one fix in this PR that isn't related to iOS - I got a test failure on Android that appears to be caused by a multithreading issue with OpenBlas - see the comment inline. I've also been able to fix the issue with x86-64 simulator support. The downside: the x86-64 simulator CI pass is slow - it takes 40+ minutes to run the test suite. This is a combination of a known issue with GitHub Actions, and the fact that x86-64 macOS hardware is older and slower. As a result, a CI pass running python 3.13, 3.14 and 3.15 takes over 2 hours. That's obviously a significant choke point on limited macOS runners. Given that x86-64 support on macOS (and thus iOS) is deprecated and near EOL anyway, I've opted to keep the code to support x86-64 iOS simulators in place (as it was essentially 2 lines of Meson config), but removed the CI configuration. |
|
Our comments just crossed:)
This sounds like the right call. We have support for lots of legacy and niche platforms, and we'll continue to accept patches as needed, but we indeed can't cover everything in CI. |
We are at 0.3.33.201, and OpenBLAS just released 0.3.24, I will be updating our build soon to 0.3.24. What do I need to do to get scipy-openblas to build the needed wheels? |
I'll have to defer to @mhsmith on that one - the OpenBLAS package is currently being installed from a ChaquoPy wheel store, providing 0.3.33. I'm not familiar with the process for publishing to that store. |
|
... and we have a green board! @rgommers I think I've addressed all your comments; let me know if you need anything else to land this! |
|
Thanks @freakboy3742. The last commits all look good. The main remaining thing is the one in my review comment above. You still have 5 CI jobs here, including 2 quite slow ones. I think a sparse test matrix of 2 jobs is appropriate at this point. |
My apologies - between the overlapped responses I misunderstood the request on that one. I've now removed the |
rgommers
left a comment
There was a problem hiding this comment.
Awesome, in it goes Thanks again @freakboy3742!
See numpygh-28759 for iOS and numpygh-30412 for Android. [skip actions]
Adds iOS as a test and release target for NumPy.
UPDATE: 17 July 2026 This PR is now ready for review. PR body reflects current status.
In an environment where:
This branch will build and test accelerated iOS simulator wheels:
You can also specify
arm64_iphoneosfor device wheels, orx86_64_iphonesimulatorfor simulator wheels on older hardware.The build will also work without the
IPHONEOS_DEPLOYMENT_TARGETdefinition, but with the older LP64 version of accelerate (this is the analog of theMACOSX_DEPLOYMENT_TARGET=14.0configuration, except that there isn't a pre-compiled openBLAS for iOS to fall back on). To build with a lower minimum iOS version, run: