Python 3.11.7 crashes with Tensorflow Metal

Hello,

I got a brand new MacBook M3 Pro and trying to configure Tensorflow w/ GPU support. I followed instructions provided at https://developer.apple.com/metal/tensorflow-plugin/ step by step. Unfortunately, even after creating/recreating/installing/uninstalling TensorFlow the problem is not getting resolved as Python crashes. I cannot get past that point to try Jupyter notebook. Here is the error ask the versions in "tf" environment. I already spent entire Saturday yesterday and so far no progress. Can someone tell me what is going on?

Python 3.11.7 (main, Dec 4 2023, 18:10:11) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import tensorflow as tf

2024-01-07 11:44:04.893581: F tensorflow/c/experimental/stream_executor/stream_executor.cc:743] Non-OK-status: stream_executor::MultiPlatformManager::RegisterPlatform( std::move(cplatform)) status: INTERNAL: platform is already registered with name: "METAL" [1] 1797 abort /opt/homebrew/bin/python3

❯ python -m pip list | grep tensorflow tensorflow 2.15.0 tensorflow-estimator 2.15.0 tensorflow-io-gcs-filesystem 0.34.0 tensorflow-macos 2.15.0 tensorflow-metal 1.1.0

❯ python --version Python 3.11.7

OS is Sonoma 14.2.1

Thanks Sohail

  • BTW, without Tensorflow-metal, python/environment works, just GPU is not being use. Here is the test in a new barebone "tf" environment.

    ❯ python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))" tf.Tensor(1842.7096, shape=(), dtype=float32) ❯ pip list | grep tensorflow tensorflow 2.15.0 tensorflow-estimator 2.15.0 tensorflow-io-gcs-filesystem 0.34.0 tensorflow-macos 2.15.0

Add a Comment