unsuccessful importing of tensorflow

Hi. I have followed the instructions here to install tensorflow with GPU support for my 16inch 2019 intel macbook pro (with AMD graphic). The installation process seems to be successful (I get no error) but, when I try to test it, after running import tensorflow as tf I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mahonik/.virtualenvs/tf-metal-new/lib/python3.11/site-packages/tensorflow/__init__.py", line 445, in <module>
    _ll.load_library(_plugin_dir)
  File "/Users/mahonik/.virtualenvs/tf-metal-new/lib/python3.11/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/mahonik/.virtualenvs/tf-metal-new/lib/python3.11/site-packages/tensorflow-plugins/libmetal_plugin.dylib, 0x0006): Symbol not found: __ZN10tensorflow16TensorShapeProtoC1ERKS0_
  Referenced from: <C62E0AB4-567E-3E14-8F96-9F07A746C4DC> /Users/mahonik/.virtualenvs/tf-metal-new/lib/python3.11/site-packages/tensorflow-plugins/libmetal_plugin.dylib
  Expected in:     <0B1F231A-6766-3F61-81D9-6782129807A9> /Users/mahonik/.virtualenvs/tf-metal-new/lib/python3.11/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so

My env's packages

...
numpy                        1.26.1
tensorboard                  2.14.1
tensorboard-data-server      0.7.1
tensorflow                   2.14.0
tensorflow-estimator         2.14.0
tensorflow-io-gcs-filesystem 0.34.0
tensorflow-metal             1.0.0
...

Replies

So, it looks like you've got python 3.11 installed. I know it says python 3.8 or later is acceptable, but if you scroll to the bottom of the page, it says 3.8, 3.9 and 3.10 are the only versions compatible with tensorflow. I started with 3.12 and it didn't work; I installed 3.10 and was able to get further than with 3.12, but I still ran into the exact same issue that you've depicted here. I might try it with 3.9, but I'm starting to get annoyed

I tried with 3.9 , ran into same issue

I also tried with 3.8 , ran into the same issue

I ran into this exact problem and tried python versions from 3.11 down to 3.9 to no avail. When I tested it in an environment with Python 3.8 it finally work. I also chose to install ipykernel and map it to my environment (using python -m ipykernel install --user --name=<env-name>) AFTER having installed Tensorflow so that may be the real remedy.

Add a Comment