symbol not found in tensorflow-metal version 0.7.0

I encountered an issue when importing tensorflow.

Specifically, when importing tensorflow, it throws:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/***/miniconda/envs/ml310/lib/python3.10/site-packages/tensorflow/__init__.py", line 439, in <module>
    _ll.load_library(_plugin_dir)
  File "/Users/***/miniconda/envs/ml310/lib/python3.10/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/***/miniconda/envs/ml310/lib/python3.10/site-packages/tensorflow-plugins/libmetal_plugin.dylib, 0x0006): symbol not found in flat namespace '__ZN3tsl8internal10LogMessage16VmoduleActivatedEPKci

Downgrading tensorflow-metal to version 0.6.0 solved the problem temporarily.

Details about python and the OS:

  • OS version: 13.1
  • Python: 3.10 (distributed by conda-forge)
  • tensorflow-macos: version 2.10.0

Hi @we_taper, can you please try tensorflow_macos==2.11.0 version with 0.7.0

I used the versions you requested (tensorflow_macos==2.11.0 version with 0.7.0), here is the error I get:


RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf

RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf

ImportError: numpy.core._multiarray_umath failed to import

ImportError: numpy.core.umath failed to import

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/__init__.py", line 37, in <module>

    from tensorflow.python.tools import module_util as _module_util

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/python/__init__.py", line 42, in <module>

    from tensorflow.python import data

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/python/data/__init__.py", line 21, in <module>

    from tensorflow.python.data import experimental

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/python/data/experimental/__init__.py", line 96, in <module>

    from tensorflow.python.data.experimental import service

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/python/data/experimental/service/__init__.py", line 419, in <module>

    from tensorflow.python.data.experimental.ops.data_service_ops import distribute

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/python/data/experimental/ops/data_service_ops.py", line 22, in <module>

    from tensorflow.python.data.experimental.ops import compression_ops

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/python/data/experimental/ops/compression_ops.py", line 16, in <module>

    from tensorflow.python.data.util import structure

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/python/data/util/structure.py", line 22, in <module>

    from tensorflow.python.data.util import nest

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/python/data/util/nest.py", line 34, in <module>

    from tensorflow.python.framework import sparse_tensor as _sparse_tensor

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/python/framework/sparse_tensor.py", line 24, in <module>

    from tensorflow.python.framework import constant_op

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/python/framework/constant_op.py", line 25, in <module>

    from tensorflow.python.eager import execute

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/python/eager/execute.py", line 21, in <module>

    from tensorflow.python.framework import dtypes

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/tensorflow/python/framework/dtypes.py", line 34, in <module>

    _np_bfloat16 = _pywrap_bfloat16.TF_bfloat16_type()

TypeError: Unable to convert function return value to a Python type! The signature was

	() -> handle

This release is clearly unusable.

@Thalesian, the issue is the mismatch in your numpy version. Can you try:

pip3 install numpy --upgrade --ignore-installed

Thanks @Frameworks Engineer, tensorflow_macos==2.11.0 version with 0.7.0 worked for me. Related info, I started with tensorflow_macos==2.10.0 because the latest version for tensorflow-deps is 2.10.0 in apple's conda channel. Perhaps it helps to update that one as well?

That fixed the import tensorflow issue. I installed on a brand new Mac installation with a new user account - so perhaps include that in the setup instructions?

Next error comes when trying to train a model:


Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/Users//<user>/miniconda/lib/python3.10/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler

    raise e.with_traceback(filtered_tb) from None

  File "/var/folders/v0/w_k546h500q00yr1lhwd78640000gn/T/__autograph_generated_filenv9ppeuc.py", line 15, in tf__train_function

    retval_ = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope)

  File "/Users//<user>/miniconda/lib/python3.10/site-packages/transformers/modeling_tf_utils.py", line 1557, in train_step

    self.optimizer.minimize(loss, self.trainable_variables, tape=tape)

  File "/Users/<user>/miniconda/lib/python3.10/site-packages/transformers/optimization_tf.py", line 246, in apply_gradients

    return super(AdamWeightDecay, self).apply_gradients(zip(grads, tvars), name=name, **kwargs)

TypeError: in user code:



    File "/Users/<user>/miniconda/lib/python3.10/site-packages/keras/engine/training.py", line 1249, in train_function  *

        return step_function(self, iterator)

    File "/Users/<user>/miniconda/lib/python3.10/site-packages/keras/engine/training.py", line 1233, in step_function  **

        outputs = model.distribute_strategy.run(run_step, args=(data,))

    File "/Users/<user>/miniconda/lib/python3.10/site-packages/keras/engine/training.py", line 1222, in run_step  **

        outputs = model.train_step(data)

    File "/Users/<user>/miniconda/lib/python3.10/site-packages/transformers/modeling_tf_utils.py", line 1557, in train_step

        self.optimizer.minimize(loss, self.trainable_variables, tape=tape)

    File "/Users/<user>/miniconda/lib/python3.10/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 527, in minimize

        self.apply_gradients(grads_and_vars)

    File "/Users/<user>/miniconda/lib/python3.10/site-packages/transformers/optimization_tf.py", line 246, in apply_gradients

        return super(AdamWeightDecay, self).apply_gradients(zip(grads, tvars), name=name, **kwargs)

    File "/Users/<user>/miniconda/lib/python3.10/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1140, in apply_gradients

        return super().apply_gradients(grads_and_vars, name=name)

    File "/Users/<user>/miniconda/lib/python3.10/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 632, in apply_gradients

        self._apply_weight_decay(trainable_variables)

    File "/Users/<user>/miniconda/lib/python3.10/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1159, in _apply_weight_decay

        tf.__internal__.distribute.interim.maybe_merge_call(

    File "/Users/<user>/miniconda/lib/python3.10/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1155, in distributed_apply_weight_decay

        distribution.extended.update(

    File "/Users/<user>/miniconda/lib/python3.10/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1149, in weight_decay_fn  **

        if self._use_weight_decay(variable):

    File "/Users/<user>/miniconda/lib/python3.10/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 587, in _use_weight_decay

        for exclude_id in exclude_from_weight_decay:



    TypeError: 'NoneType' object is not iterable

I have to revert to earlier versions to continue my work still. But they're problem (tensorflow-metal 0.5.0 and tensorflow-macos 2.9, but that stops randomly during training. Not sure if there is any stable configuration.

symbol not found in tensorflow-metal version 0.7.0
 
 
Q