-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
macOS arm64 requires numpy 1.20.0 or above #20
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kbourgoin. This makes sense to add. I'm wondering if this also needs
platform_system=='darwin'
because there may be Windows arm64
machines.
I can't find any place that authoritatively defines platform_machine
, so hard to be sure.
setup.cfg
Outdated
|
||
numpy==1.19.0; python_version=='3.6' and platform_python_implementation=='PyPy' | ||
numpy==1.20.0; python_version=='3.7' and platform_python_implementation=='PyPy' | ||
|
||
# arm64 supports Python 3.8 and above requires numpy>=1.20.0 | ||
numpy==1.20.0; python_version=='3.8' and platform_machine=='arm64' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a note to this: while Python 3.8 on arm64
works, there is no way to cross-compile from an x86_64
machine to arm64
- that's only possible for Python >= 3.9. Hence effectively it's almost impossible to provide 3.8 wheels, because projects do that on CI - and there's no macOS M1 CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a note to this: while Python 3.8 on arm64 works, there is no way to cross-compile from an x86_64 machine to arm64 - that's only possible for Python >= 3.9
Why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need a machine with macOS 11, as the final CPython 3.8 binary release does have an experimental Universal2 build, it does not work on macOS 10.9+ like the 3.9 releases. I think once macOS 11 is readily available on CI, it might be easier to compile 3.8 universal or cross-compiled arm64
binaries.
You can also use the Xcode python 3.8, which is universal, and supports 10.15+, but that will only work as long as Xcode doesn't replace it with 3.9 in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(yes, "there is no way to cross-compile" is not true, it's a bit hard due to the issues listed above, but not impossible)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the info. We could use the regular python 3.8 build. Universal build is not necessary to build wheels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works just fine for numpy. See MacPython/numpy-wheels#115
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the resolution here was that CPython 3.8 universal was built without MACOS_DEPLOYMENT_TARGET and as such wouldn't work. Looks like that's a macOS 10.15 runner, though, for MacPython? Ah, you are building universal2 from python-3.8.10-macosx10.9.pkg
. I didn't realize you could build a universal2 build from a non-universal Python. Is there a way I can download the wheel artifact and try it out on my M1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I really wish I'd left a machine on 10.15 for tests like this...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way I can download the wheel artifact and try it out on my M1?
If that PR is merged, then yes. cc @mattip
@rgommers as far as I could find while looking, I could add it to lines 48/49, but then it makes 42/43 much more complex. Is it worth it to makes those lines harder to read? If so, I can try to make it work. |
The Windows case I hadn't even thought about - I was more thinking about about other custom chips. I don't think they're guaranteed to all be named
How about this, move 48/49 above the block of lines for |
Just a note here on
That of course is very weird, since there's no such a hardware architecture, but it is what's done at https://github.com/pypa/cibuildwheel/pull/484/files. If we build a The Cc @joerick and @isuruf, could you comment on whether the |
Alright, gave it an update. Let me know if this works. It works on my machine, but in a strange quirk of life, I don't have anything but an M1 to test this on right now. |
Hmm. Tricky... when cibuildwheel builds arm64 and universal2 wheels, we're cross compiling from x64_64 by setting I'll also cc @henryiii who might have some ideas! |
@rgommers I don't actually see what's different in Multibuild vs. cibuildwheel. In both systems, you set "universal2", in both systems you get I'm building boost-histogram Python 3.8 wheels with a (patched) cibuildwheel using the x86_64 Python, and you are correct; I was able to get an arm64 wheel that works on my M1. (Universal2 actually produced x86_64 tagged wheels, not sure why - the size is correct for the dual arch's, though) |
@rgommers Sorry, now I see "what's different" in the new docs in that PR - multibuild does option 2 and cibuildwheel does option 1. Might be something to look at in the future as an option. |
Thanks @kbourgoin, I think that looks good. I pushed a small change to also add the It looks like the I do have a non-M1 machine, will do a quick test now. |
Changes taken over from scipygh-14145 and from scipy/oldest-supported-numpy#20
Changes taken over from scipygh-14145 and from scipy/oldest-supported-numpy#20
In it goes. Thanks @kbourgoin |
This is the first NumPy version with universal2 wheels, and 1.21.0 was just released so we can do the version bump. This is a follow-up to scipygh-19 and scipygh-20
Fixes #19