Install Tensorflow on M1/M2 MacBook natively
Install TensorFlow in a few steps on Mac M1/M2 with GPU support and benefit from the native performance of the new Mac ARM64 architecture. Why use a Mac M1/M2 for Data Science and Deep Learning? What makes the Macs M1 and the new M2 stand out is not only their outstanding performance, but also the extremely low power consumption. Installation of Tensorflow with GPU support Here are the things that we are going to do. Install Xcode Command Line Tool Install the M1 Miniconda Version Install Tensorflow Install Jupyter Notebook and common packages 1. Install Xcode Command Line Tool If it’s not already installed in your system, you can install it by running the following command below in your Mac OSX terminal. xcode-select --install 2. Install the M1 Miniconda Version Miniconda is the minimal set of features from the extensive Anaconda Python distribution and includes many of the data science related packages that are needed by this class. Download the Miniconda3 macOS Apple M1 64-bit.pkg from here and install it on your Application directory. 3. Install Tensorflow Change to the Application/miniconda3 directory in your terminal with: cd /Applications/miniconda3 Install the Tensorflow dependencies: conda install -c apple tensorflow-deps Install base Tensorflow: pip install tensorflow-macos Install Metal plugin: pip install tensorflow-metal 4. Install Jupyter Notebook and common packages Install first Jupyter Notebook: conda install notebook -y Now install common additional packages and upgrade the packages so that they are updated to the M1 architecture. pip install numpy --upgrade pip install pandas --upgrade pip install matplotlib --upgrade pip install scikit-learn --upgrade pip install scipy --upgrade pip install plotly --upgrade Start now Jupyter Notebook in your desired working directory (change Please note that macOS M1 does not support Qt yet — Anaconda Navigator and Spyder will not be available. Please check back for updates. 5. Check GPU availability Check the Python version and the GPU availability with this code: import sys import tensorflow.keras import pandas as pd import sklearn as sk import scipy as sp import tensorflow as tf print("GPU is", "available" if gpu else "NOT AVAILABLE")
Download
0 formatsNo download links available.