Symbol Not Found Error: Tensorflow Metal for Apple M1

I have followed all instructions in this tutorial to install Tensorflow-MacOS and Tensorflow Metal for my Apple 16GB M1 Mac mini (2020) running Big Sur 11.5.1.

All installations completed without error, but I am still getting the following traceback when trying to use Tensorflow:

Traceback (most recent call last):

  File "train_model.py", line 3, in <module>

    import tensorflow as tf

  File "/Users/thesis/miniforge3/envs/thesis_env/lib/python3.8/site-packages/tensorflow/__init__.py", line 440, in <module>

    _ll.load_library(_plugin_dir)

  File "/Users/thesis/miniforge3/envs/thesis_env/lib/python3.8/site-packages/tensorflow/python/framework/load_library.py", line 153, in load_library

    py_tf.TF_LoadLibrary(lib)

tensorflow.python.framework.errors_impl.NotFoundError: dlopen(/Users/thesis/miniforge3/envs/thesis_env/lib/python3.8/site-packages/tensorflow-plugins/libmetal_plugin.dylib, 6): Symbol not found: _TF_AllocateOutput

  Referenced from: /Users/thesis/miniforge3/envs/thesis_env/lib/python3.8/site-packages/tensorflow-plugins/libmetal_plugin.dylib

  Expected in: flat namespace

I have seen similar issues reported related to the "Symbol not found: " portion of the traceback, but the answer given there (basically, to double-check that the versions of TensorflowMacOS and the Tensorflow Metal plugin match) does not apply to me - both are current and were installed today.

If I run the terminal commands for installation again, I get messages informing me that all requirements are already satisfied.

A fix would be appreciated - I need to begin training a DL model for my graduate thesis project, and I purchased the computer in part for this particular project.

Update: Solved by reinstalling all packages in a new virtual environment.

@Apple Dev team, can you kindly tell me a way to do it without reinstallation of all packages since I have all my TensorFlow and datascience libraries in the main python stream and not in any virtual env

Hi Folks! I know it's been a year, but I'm having the same problem and reinstalling the virtual environment doesn't help. I'm using an M1 Mac with Monterey. Here's what I do:

  1. Start with no tensorflow installed in the virtual environment.
  2. Install tensorflow-macos:

python -m pip install tensorflow-macos

NOTE: At this point, I can use tensorflow without issue, but it's really really slow. It shows as version 2.11.0

  1. Install the metal hooks:

python -m pip install tensorflow-metal

NOTE: This shows as version 0.8.0 But NOW, when I try to run it, I get the error: [...]site-packages/tensorflow-plugins/libmetal_plugin.dylib, 0x0006): symbol not found in flat namespace (_TF_GetInputPropertiesList)

In the tensorflow plugin directory is libmetal_plugin_dylib. I can't find any other info about it other than its size is 3,640,696 bytes if that helps narrow down the version.

Any thoughts as to how to get metal TF working? Much appreciated. :)

Follow up: The good news is a simple:

python -m pip uninstall tensorflow-metal

Removed the metal plugin, and now everything runs fine again. So the issue is clearly that we need a new metal plugin compatible with tensorflow-macos?

I was having the same problem, but checking the releases section on the official Apple Documentation, I found that we have specific tensorflow-metal versions for each specific tensorflow-macos versions.

My choice was:

python -m pip install tensorflow-macos==2.9.0
python -m pip install tensorflow-metal==0.5.0

It worked fine! Remembering that I have specified the tensorflow-deps as 2.9.0 as well.

conda install -c apple tensorflow-deps==2.9.0

The latest version of tensorflow-deps is 2.10.0. To install tensorflow-metal on my MacBook Pro with M1 Max I followed the following steps:

# create a virtual env
conda env create -n &lt;your-env-name-here>

# install tensorflow-deps==2.10.0 with a compatible python version
conda install -c apple -c conda-forge -c nodefaults tensorflow-deps

# install tensorflow-macos compatible with tensorflow-deps
python -m pip install tensorflow-macos==2.10.0

# install tensorflow-metal compatible with tensorflow-macos
python -m pip install tensorflow-metal==0.6.0
Symbol Not Found Error: Tensorflow Metal for Apple M1
 
 
Q