tensorflow-metal error

I'm using python 3.9.6, tensorflow 2.20.0, tensorflow-metal 1.2.0, and when I try to run

import tensorflow as tf

It gives

Traceback (most recent call last):
  File "/Users/haoduoyu/Code/demo.py", line 1, in <module>
    import tensorflow as tf
  File "/Users/haoduoyu/Code/test/lib/python3.9/site-packages/tensorflow/__init__.py", line 438, in <module>
    _ll.load_library(_plugin_dir)
  File "/Users/haoduoyu/Code/test/lib/python3.9/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/haoduoyu/Code/test/lib/python3.9/site-packages/tensorflow-plugins/libmetal_plugin.dylib, 0x0006): Library not loaded: @rpath/_pywrap_tensorflow_internal.so
  Referenced from: <8B62586B-B082-3113-93AB-FD766A9960AE> /Users/haoduoyu/Code/test/lib/python3.9/site-packages/tensorflow-plugins/libmetal_plugin.dylib
  Reason: tried: '/Users/haoduoyu/Code/test/lib/python3.9/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/haoduoyu/Code/test/lib/python3.9/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)

As long as I uninstall tensorflow-metal, nothing goes wrong. How can I fix this problem?

I have the exact same issue, same versions for everything, same error message.

macOS Tahoe 26.2

macbook pro M1 14 inch

update: I was able to get it to work. The key was to do the following:

pip install tensorflow-macos
pip install tensorflow-metal

I saw that somewhere on reddit, but it worked for me, I could import tf without any issue, and when I created a tensor, I got diagnostics implying that metal acceleration was being used

For reference, I got the issues by the OP when I did install tensorflow instead of install tensorflow-macos, which seems to be incorrectly suggested (as of today Jan 7 2026) by the official Apple tf metal docs.

I can't tell if tensorflow-macos is an official package, but whatever.

I can also confirm that the official developer guide "Get started with tensorflow-metal" explicitly recommends to use pip install tensorflow for version 2.13 or later and to only use pip install tensorflow-macos for versions 2.12 or earlier.

But with tensorflow 2.20 it will cause this issue.

tensorflow-metal error
 
 
Q