Tensorflow doesn't work with GPU after installing tensorflow-metal

Hi, I followed instructions for installing tensorflow-macos and tensorflow-metal on my MacBook Air M1 (2020), with MacOs version 12.4, but after running tf.config.list_physical_devices('GPU') I get []. What could be the problem?

Accepted Answer

Hi @Om80,

First thing that comes to mind is that you are running you python script in a different python environment than where you installed tensorflow-metal into. Can you try checking the list of installed packages from pip in the same shell environment you are trying to execute the python script and verify that tensorflow-metal is in there? This can be done using python -m pip list.

Notably if you were following the guide at https://developer.apple.com/metal/tensorflow-plugin/ for M1, tensorflow-metal and tensorflow-macos are installed into the conda environment. So you'll also need to be in the conda environment when executing the script or at least set python paths to use the libraries in the environment.

Tensorflow doesn't work with GPU after installing tensorflow-metal
 
 
Q