I'm trying to install tensorflow with metal support on my 16" macbook pro (intel) using these steps:
Getting Started with tensorflow-metal PluggableDevice
Based on issue 683757, I used a python 3.8 environment, but I still got the same error:
(tensorflow-metal_env) (base) f@As-MBP Environments % pip list
Package Version
---------- -------
pip 21.1.3
setuptools 57.0.0
wheel 0.36.2
(tensorflow-metal_env) (base) f@As-MBP Environments % python -m pip install tensorflow-macos
ERROR: Could not find a version that satisfies the requirement tensorflow-macos (from versions: none)
ERROR: No matching distribution found for tensorflow-macos
(tensorflow-metal_env) (base) f@As-MBP Environments % python -V
Python 3.8.1
How can I get tensorflow-macos installed?
Thanks for the help! Adam
I’ve installed it on my Mac Mini M1 (straightforward, follow the instructions) and on my MBP 16, in both cases obviously running MacOS 12 Monterey. The later (on Intel) was less obvious but in short, you do not required a conda environment (such as Miniforge), you want Apple’s native Python. However, the one that ships with the OS is 2.7, therefore you should run:
xcode-select --install
This will install python 3.8.2 built with clang 13, and to make sure you are getting version 3 run it as python3
. Now go back to the instructions, and create a python venv (ignore the optional bit), then install the latest version of pip. Finally pip install the tensorflow-macos and tensorflow-metal packages. Done!
To verify the installation, fire up python and run the following code:
import tensorflow as tf
devices = tf.config.list_physical_devices()
print(devices)
You should now see CPU0 and GPU0 listed!