Issue
I have macOS Big Sur on a Apple Silicon M1 and I'm unable to install Tensorflow in python3. I removed xcode python3 and installed brew arm64 python3 (x86 python3 doesn't work as well)
I checked successful 64 bis version
python3 -c "import sys; print(sys.version)" or python -c "import struct; print(struct.calcsize('P')*8)"
3.8.7 (default, Dec 30 2020, 02:09:32) [Clang 12.0.0 (clang-1200.0.32.28)]
Can this work anyhow, or who knows, how to make this work ?
Solution
Apple M1 is a processor with an ARM64 architecture, while all pip packages of TensorFlow are compiled for the x86_64 architecture. (excluding the raspberry pi packages, but they would not be compatible with MacOs anyway).
If we look at the name of the pip packages on the install page of TensorFlow, most of them contains either x86_64
or amd64
, that indicates that they are built against the x86_64 architecture.
If you want to run TensorFlow on the M1, you either need to:
- compile TensorFlow from sources targeting x86_64 through Rosetta 2. Unfortunately, according to this issue on github, Rosetta 2 does not support the AVX instruction set which are enabled in the pip builds of TensorFlow, so rebuilding from source is needed.
- Use the experimental support for TensorFlow on M1 developed by Apple, that you can find on this github repository. Note that, if going that way, some python packages might not be compatible/available with the M1.
Note that as of 2021/01/04, the Apple M1 is not a supported architecture by the TensorFlow team:
We currently cannot support Mac ARM. There is less than one developer than can focus on build issues on all 3 operating systems.
Hence, support has to come from the the community. There is SIG Build that focuses on build related issues on several other platforms, leaving us to only focus on the pip packages we officially bless.
Answered By - Lescurel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.