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
Support for Apple Silicon arm64 architecture in pip wheels #1377
Comments
I also want to know how to install SimpleITK on my Apple MacBook Pro 2020 with M1 CPU. I can't even build it |
@giuseppefilitto Steps to build SimpleITK with Python wrapping: I assume that you have Xcode command line tools, homebrew and your Python environment (e.g. brew install cmake
conda create --name sitk python=3.8
conda activate sitk
git clone https://github.com/SimpleITK/SimpleITK.git
mkdir SimpleITK-build
cd SimpleITK-build
CC=clang CXX=clang++ cmake \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF \
-DWRAP_PYTHON=ON \
-DWRAP_CSHARP=OFF \
-DWRAP_JAVA=OFF \
-DWRAP_LUA=OFF \
-DWRAP_R=OFF \
-DWRAP_RUBY=OFF \
-DWRAP_TCL=OFF \
../SimpleITK/SuperBuild
make -j8 # build SimpleITK
make -C SimpleITK-build dist # build Python wheel You now find a Python wheel for SimpleITK in pip install --no-deps ./SimpleITK-build/Wrapping/Python/dist/SimpleITK-*arm64.whl |
@mlaves thanks man, I will try to do so and let you know! |
@mlaves same issue here, I think that we could enjoy simpleITK on the apple silicon M1 when the next release will be out. I guess they added this issue to the v2.1 milestone |
@mlaves I get hung up on building the Python wheel on my M1. Everything seems good until the end:
|
@dmtien Is your terminal running in ARM mode? |
@mlaves Yes, I was running iterm2 which is a universal binary, but just to be safe, I repeated the steps in Apple's terminal with the same results. I have the same setup as you, except I'm running MacOS 11.3. Does it have anything to do with the fact that you've invoked python 3.8 in the virtual environment, which isn't ARM64 native? |
@dmtien I'm running python 3.8 from miniforge, which is ARM64 native. Maybe your python is still Intel? |
Progress is being made with getting SimpleITK's Conda-forge package building for apple ARM. The libitk feedstock has been updated to build for, and now contains the package for |
@Alex97schmid Can you please ensure that your Python interpreter was compiled for
should return Nevertheless, you'll find my wheel here: https://1drv.ms/u/s!AiF3lPpzI9TejrZFwFytnElPR2jAKA?e=uedfRs @blowekamp Progress is great! |
Thanks a lot for the wheel!, the installation worked! Currently I'm not using miniforge, I just created a virtual-environment with python 3.8, which I installed through homebrew. So far, I was quite successful installing the packages I need and they are all running natively. How is your experience with miniforge? |
@Alex97schmid At the time I got my M1 Mac, miniforge seemed to be the only option to get native |
I met many undeclared identifier errors when building it using your approach: But I found that the wheel file you build is great on my mac. Could you please help to build a 1.2.4 version of SITK? Torchio needs Sitk under version 2.0 |
Unfortunately, 1.2 is a quite an old version of SimpleIT and is based on ITK 4.x. ITK only began supporting apple ARM when the hardware was released with ITK version 5.2. I am unaware of any effort to back port the changes to ITK 4.x. I believe it would be better use of the communities time to update torchio to support SimpleITK 2.x. It is better to move forward than backwards. Please let know if there is anything I can assist with that effort. |
Hello @MeteorsHub, There were issues with the threading model change in ITK/SimpleITK which affected Torchio, these were in SimpleITK versions 2.0.* (see here for details). These have been resolved in the upcoming release, 2.1. For now you can use the latest SimpleITK pre-release wheel available from github. This line in Torchio's setup.py file will need to be changed to |
Thanks a lot. I've installed it. By the way, the SimpleITK should include macos-arm64 binary release. |
Apple ARM64 binary wheels have been uploaded to v2.1rc2 , please test and close the issue. |
SimpleITK v2.1.0 was released with Apple ARM64 support to pypi. |
I was able to successfully compile SimpleITK from source on a new Apple Silicon M1 CPU, including Python wrapping. However, installing from pypi using pip fails.
Steps to reproduce:
macOS 11.2.3
Miniforge3-MacOSX-arm64
It fails with the following error:
Full output attached:
sitk_pip_apple_silicon.log.zip
The text was updated successfully, but these errors were encountered: