INTERNAL: platform is already registered with name: "METAL"

I'm trying to get TensorFlow with Metal support running on my iMac (2017, Radeon 580 Pro) following these instructions. However, simply importing tensorflow ( import tensorflow ) results in the following error with the Python console crashing:

2022-05-27 11:46:12.419950: F tensorflow/c/experimental/stream_executor/stream_executor.cc:808] Non-OK-status: stream_executor::MultiPlatformManager::RegisterPlatform( std::move(cplatform)) status: INTERNAL: platform is already registered with name: "METAL"

Abort trap: 6

Versions: macOS 12.3, Python 3.8.13, tensorflow-macos 2.9.0, tensorflow-metal 0.5.0

Update: Performed a fresh install of macOS on an external drive. Problem remains with same error message.

Hi @TechTobi

It looks like you might have installed both tensorflow-macos and tensorflow installed into your environment causing the confusion with the stream_executor registration. Can you list the exact commands you used to create the environment and verify they are exactly the same as listed in the instruction page you linked. Additionally could you paste the output of python -m pip list inside the environment? There you should not see tensorflow listed as one of the packages but instead tensorflow-macos and tensorflow-metal.

Nope, no tensorflow, only tensorflow-macos is installed.

Step 1:

python3.8 -m venv tf-metal-new
source tf-metal-new/bin/activate
python3.8 -m pip install -U pip

Step 2:

python3.8 -m pip install tensorflow-macos

Step 3:

python3.8 -m pip install tensorflow-metal

Pip Output:

(tf-metal-new) iMac:programming Tobi$ python3.8 -m pip list

Package                 Version

----------------------- -----------

absl-py                 1.0.0

astunparse              1.6.3

cachetools              5.1.0

certifi                 2022.5.18.1

charset-normalizer      2.0.12

cycler                  0.11.0

Cython                  0.29.30

distlib                 0.3.4

filelock                3.7.0

flatbuffers             1.12

fonttools               4.33.3

gast                    0.4.0

google-auth             2.6.6

google-auth-oauthlib    0.4.6

google-pasta            0.2.0

grpcio                  1.46.3

h5py                    3.7.0

idna                    3.3

importlib-metadata      4.11.4

keras                   2.9.0

Keras-Preprocessing     1.1.2

kiwisolver              1.4.2

libclang                14.0.1

Markdown                3.3.7

matplotlib              3.5.2

numpy                   1.22.4

oauthlib                3.2.0

opt-einsum              3.3.0

packaging               21.3

Pillow                  9.1.1

pip                     22.1.2

platformdirs            2.5.2

protobuf                3.19.4

pyasn1                  0.4.8

pyasn1-modules          0.2.8

pyparsing               3.0.9

python-dateutil         2.8.2

requests                2.27.1

requests-oauthlib       1.3.1

rsa                     4.8

setuptools              60.10.0

six                     1.15.0

tensorboard             2.9.0

tensorboard-data-server 0.6.1

tensorboard-plugin-wit  1.8.1

tensorflow-macos        2.9.2

tensorflow-metal        0.5.0

termcolor               1.1.0

typing_extensions       4.2.0

urllib3                 1.26.9

virtualenv              20.14.1

Werkzeug                2.1.2

wheel                   0.37.1

wrapt                   1.14.1

zipp                    3.8.0

(tf-metal-new) iMac:programming Tobi$ 
INTERNAL: platform is already registered with name: "METAL"
 
 
Q