Back to Blog
You need to install the TensorFlow that supports M1 chip Native hardware acceleration is supported on M1 Macs and Intel-based Macs through Apple’s ML Compute framework. Now there is a pre-release that delivers hardware-accelerated TensorFlow and TensorFlow Addons for macOS 11.0+. You can replace my_tf_env with any other name/path you choose. If you have multiple python installations, use: arch -arm64 bash install_venv.sh -python=/usr/bin/python3 my_tf_env You can do this by installing the script like this: arch -arm64 bash install_venv.sh my_tf_env Here, it's very important to specify which one to use. usr/bin/python3 (for architecture arm64e): Mach-O 64-bit executable arm64e usr/bin/python3 (for architecture x86_64): Mach-O 64-bit executable x86_64 usr/bin/python3: Mach-O universal binary with 2 architectures: # If you installed python through Homebrew or Anaconda, deactivate your conda env, then run this line instead: ![]() Python3 is shipped with 2 architectures in M1. You can skip the virtual env steps (assuming you have a virtual env activated through Conda) and just go straight to the pip install as mentioned above (steps 3 and later). Note: If you are using anaconda, the above will also work. If there is no 'zsh illegal hardware instruction" error you should be good to go. Step 4 Type python which will bring up >in your terminal and type > import tensorflow Pip install ~/Downloads/tensorflow-2.4.1-p圓-none-any.whl in your activated virtual environment Step 3.1 Assuming you simply installed the wheel to downloads run ![]() Step 3 Install the tensorflow wheel called tensorflow-2.4.1-p圓-none-any.whl located at this public google drive link Step 2.2 Activate that virtual environment by running source ENV/bin/activate Step 2.1 Create a virtual environment by running virtualenv ENV Step 2 Install virtualenv via pip install virtualenv Step 1.2 Once you have python version 3.8.5 running which you can check by running python -V which should output: Python 3.8.5 Step 1.1 Use this post( ) if you have troubles running pyenv in zsh. Step 1 Using pyenv install python version 3.8.5 and set it as your default python version. In the meantime, reverting to tensorflow(-gpu) 1.5.0 using something like what mentioned above is an effective workaround.This worked for me after trying a bunch of solutions to no avail. The provided installation instructions do not mention any specific CPU requirements nor how to determine compatibility with the provided binaries. The solution would be for a build of tensorflow(-gpu) that is not compiled with AVX instructions to be published (or to build a copy locally). ![]() The tensorflow(-gpu) 1.5.0 pip packages do not use AVX instructions, and thus there are no problems using it with these CPUs. Which is an AVX instruction not supported on older or less-featureful CPUs that do not have AVX support. Running python3 through GDB and disassembling the crashing function points to this instruction: => 0x00007fffb9689660 : vmovdqu 0x10(%r13),%xmm1 This seems to be occurring due to the use of AVX instructions in the latest Tensorflow packages uploaded to pip. I get stack traces similar to what is mentioned in this ticket's description. Zsh: illegal hardware instruction python3 -m tensorflow Simply running this produces a SIGILL: $ python3 -m tensorflow I have installed tensorflow using pip itself. I am encountering this issue as well with tensorflow-gpu 1.6.0, on linux, using python 3.6.4.
0 Comments
Read More
Leave a Reply. |