-
Notifications
You must be signed in to change notification settings - Fork 853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wheel support for macOS arm64 (Apple Silicon) #429
Comments
Everything is pending this largeish CI migration task described in here: #422 This repository does not use those build scripts but it looks like the cross compilation needs just a few additional CMake flags so it shouldn't be a problem to build those wheels in the future. |
@skvark Thanks! Looks like Travis CI shutting off OSS repositories has significantly interfered with any work. |
One important thing that I would like to add to my previous comment: It will take some time to get native Recommended reading: https://github.com/neurolabusc/AppleSiliconForNeuroimaging Numpy: numpy/numpy#17807 (comment) |
@skvark In regards to cross compilation, I don't know whether numpy are using macOS CI runners are not, but Clang 12+ on macOS with the Xcode 12+ Command Line Tools installed supports cross compilation from Intel to |
Note that the conda-forge community project had built a M1-native version of the numpy, scipy, pandas, scikit-learn... stack even prior to the release of the first M1 Mac Books. You can install those packages by setting up a conda env with: https://github.com/conda-forge/miniforge I use it on a daily basis and it works great. Note that conda-forge does not ship tensorflow though. |
This is not a conda-forge project. This repository uses the standard Python package distribution tooling ( In short: when someone runs |
@svkark |
This repository depends on the official binary releases which means that I need official pre-built wheel packages. There are none: https://pypi.org/project/numpy/#files You can of course run the build for both |
OpenCV team considers to migrate some of package builds to Github Action platform, first of all for Mac. M1 packages availability depends on M1 support on Github side. Related items:
|
More details: github/roadmap#95 |
My motivation is a working When I understand right, it makes no sense to donate some Travis credits to make a single event macOS build for arm64 (M1), because a CI is needed with Apple Silicon M1 machines. Travis has no such machines. Am I right ? Github actions doesn't have any such machines either. That's why a CI with Github action doesn't fulfill my needs too.
To build local Using https://github.com/apple/tensorflow_macos install |
I tried to build local
but I run into Does is mean |
Using Travis is way too expensive and I'm pretty sure that it will not be used in any future builds. You are right that there is no Apple Silicon build environment in Travis. And yes, you have to do a local build of OpenCV for Apple Silicon. Another option is to use Rosetta but I don't know how that works (https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment). NumPy doesn't provide a native wheel for Apple Silicon: https://pypi.org/project/numpy/1.20.1/#files So yes, we need native Apple Silicon wheels to PyPI for NumPy before this project can be built and published to PyPI. If the NumPy wheels are not available, You can manually build the native NumPy wheel or find some pre-built archive. To build NumPy, please see the NumPy issue: numpy/numpy#17807 (comment) Then you need to tell I don't own any Apple machines so I can't help much with this. |
I followed numpy/numpy#17807 (comment)
all without errors, bun on last I see this
and |
👋 got here after going down the rabbit hole to install Auto Editor. numpy 1.20.1 now builds natively for M1/aarch64, so it should be possible to remove that as a blocker for this. I'm now going down the rabbit hole to install 4.5.1.48 manually. Wish me luck. Update: mental horsepower down and stopped because I'm a noob when it comes to manually installing with python. I'll keep trying. In case anyone has instructions on how to manually install https://github.com/opencv/opencv-python/releases/tag/48 on macOS M1, that'd be swell. Otherwise, I'll continue documenting my process. |
@togume I don't want eliminate your motivation. Having a pip installation would be very nice ! I at least gave up here with my too small knowledge, but I made it work Tensorflow with openCV on Apple Silicon M1 |
Easiest way to try if Follow the manual build instructions in README until step 5 (https://github.com/opencv/opencv-python#manual-builds) Replace step 5. with a manual install of build dependencies: After that run: I recommend doing these steps in a fresh virtualenv with up-to-date tools. If that does work, then we need to update |
Thanks, @skvark! TL;DR: your instructions worked and I was able to successfully build. Doing. Here's my log:
Ran out of time. Now I have to figure out how to use it with |
Amazing what not being tired allows you to do... 🤦 TIL that after you have the module built locally, you do Confirming that I was able to get Thanks for all the support, people! Let me know if there's any feedback, questions, further testing I can help with here. |
@hannesa2 because it installed completely with Regarding the |
@hannesa2 You are trying to install Tensorflow Python 3.8 wheels to Python 3.9 virtualenv. Installing Tensorflow is not related to |
Tried several times with different versions of numpy and opencv. Didn't work, same error every time. Switched to miniforge conda eventually. Their opencv works perfectly |
sorry for the ignorance, but what do i need to do after i generate the zipped file?
|
You have to change the name of a wheel from Another solution is to define the variable |
PR: #507. Package will be available with OpenCV 4.5.3 release. |
OpenCV 4.50 supports building for Apple Silicon (view release notes, PR opencv/opencv#18094 was merged and released in 4.50). Now that the size limit for the project on PyPI has been increased, is there any chance we get prebuilt wheels for macOS arm64? The build script supports cross compilation from x86_64 to arm64, so I don't think dedicated Apple Silicon CI hardware is needed.
The text was updated successfully, but these errors were encountered: