tensorflow-metal fails with tensorflow > 2.18.1

Also submitted as feedback (ID: FB20612561).

Tensorflow-metal fails on tensorflow versions above 2.18.1, but works fine on tensorflow 2.18.1

In a new python 3.12 virtual environment: pip install tensorflow pip install tensor flow-metal python -c "import tensorflow as tf"

Prints error: Traceback (most recent call last): File "<string>", line 1, in <module> File "/Users/<redacted>/pt/venv/lib/python3.12/site-packages/tensorflow/init.py", line 438, in <module> _ll.load_library(_plugin_dir) File "/Users/<redacted>/pt/venv/lib/python3.12/site-packages/tensorflow/python/framework/load_library.py", line 151, in load_library py_tf.TF_LoadLibrary(lib) tensorflow.python.framework.errors_impl.NotFoundError: dlopen(/Users/<redacted>/pt/venv/lib/python3.12/site-packages/tensorflow-plugins/libmetal_plugin.dylib, 0x0006): Library not loaded: @rpath/_pywrap_tensorflow_internal.so Referenced from: <8B62586B-B082-3113-93AB-FD766A9960AE> /Users/<redacted>/pt/venv/lib/python3.12/site-packages/tensorflow-plugins/libmetal_plugin.dylib Reason: tried: '/Users/<redacted>/pt/venv/lib/python3.12/site-packages/tensorflow-plugins/../_solib_darwin_arm64/_U@local_Uconfig_Utf_S_S_C_Upywrap_Utensorflow_Uinternal___Uexternal_Slocal_Uconfig_Utf/_pywrap_tensorflow_internal.so' (no such file), '/Users/<redacted>/pt/venv/lib/python3.12/site-packages/tensorflow-plugins/../_solib_darwin_arm64/_U@local_Uconfig_Utf_S_S_C_Upywrap_Utensorflow_Uinternal___Uexternal_Slocal_Uconfig_Utf/_pywrap_tensorflow_internal.so' (no such file), '/opt/homebrew/lib/_pywrap_tensorflow_internal.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/_pywrap_tensorflow_internal.so' (no such file)

Answered by DTS Engineer in 861982022

Hello,

Thank you for the bug report!

The short answer is lack of support for python greater than 3.10.

You'll find a more detailed answer is here.

Hello,

Thank you for the bug report!

The short answer is lack of support for python greater than 3.10.

You'll find a more detailed answer is here.

Not quite so. The same error occurs for me using tensorflow==2.20.0 and tensorflow-metal==1.2.0 in a Python 3.10 venv running on an M2 Max MBP.

I have the same issue on a M4 Pro MBP, tried from python 3.9 to 3.12 with every version and all of them produce the same issue. Please try to fix.

Here is the only solution that worked for me:

conda create --name tf_metal python=3.9
conda activate tf_metal

conda install -c apple tensorflow-deps
pip install tensorflow-macos
pip install tensorflow-metal
tensorflow-metal fails with tensorflow &gt; 2.18.1
 
 
Q