Skip to content

Instantly share code, notes, and snippets.

@kjuq
Created December 3, 2021 09:49
Show Gist options
  • Select an option

  • Save kjuq/a487a5b7e4d2f5aa2b544b38a6680209 to your computer and use it in GitHub Desktop.

Select an option

Save kjuq/a487a5b7e4d2f5aa2b544b38a6680209 to your computer and use it in GitHub Desktop.
How to Install Tensorflow on M1 Mac

How to Install Tensorflow on M1 Mac

Install miniforge

brew install miniforge

Initialize miniforge

conda init "$(basename "${SHELL}")"

Create the environment for tensorflow on M1 Mac

conda create --name m1_tensorflow python=3.8

Activate the environment

conda activate m1_tensorflow

Install dependencies for tensorflow

conda install -c apple tensorflow-deps

Install base tensorflow

python -m pip install tensorflow-macos

Install tensorflow-metal plugin (it's used when you have GPU)

python -m pip install tensorflow-metal

Install matplotlib

conda install matplotlib

TIPS: recommend to use conda install to install packages instead of pip install as long as you can.

References

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment