How to Install Tensorflow on Apple MacBook M1.

Shrayan Bandyopadhyay
2 min readOct 30, 2021

--

Apple silicone has revolutionised the industry in terms of speed and usability. It is way faster than any other processor out in the market fitted inside a laptop.

Follow these codes and install Tensorflow on your Apple Silicone mac.

Step 1: Setting up Environment

Create virtual environment (recommended):

Note: Python version 3.8 required.

x86 : AMD

python3 -m venv ~/tensorflow-metal
source ~/tensorflow-metal/bin/activate
python -m pip install -U pip

arm64 : Apple Silicon

First download Conda env: ← Click on this link.

chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
source ~/miniforge3/bin/activate

Installing Tensorflow dependencies:

conda install -c apple tensorflow-deps

Step 2: Install Base Tensorflow

python -m pip install tensorflow-macos

NOTE: If using conda environment built against pre-macOS 11 SDK use: SYSTEM_VERSION_COMPAT=0 python -m pip install tensorflow-macos otherwise you will get errors like : “not a supported wheel on this platform”.

Step 3: Install tensorflow-metal plugin

python -m pip install tensorflow-metal

Finally check if tensorflow is working: Open your terminal and run the following commands.

python3>>>import tensorflow as tf
>>>tf.__version__
'2.6.0'

SOURCE: https://developer.apple.com/metal/tensorflow-plugin/

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Shrayan Bandyopadhyay
Shrayan Bandyopadhyay

Written by Shrayan Bandyopadhyay

Create a tidal wave and not a ripple.

No responses yet

Write a response