Post

Replies

Boosts

Views

Activity

Error in Tensorflow on M1
Hi. I work on M1 pro Mac (macOS 12.0.1) and try to use tensorflow-metal. I followed the guide in https://developer.apple.com/metal/tensorflow-plugin/ but I received the following errors when I imported tensorflow: 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 "", line 1, in   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/init.py", line 37, in     from tensorflow.python.tools import module_util as _module_util   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/python/init.py", line 42, in     from tensorflow.python import data   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/python/data/init.py", line 21, in     from tensorflow.python.data import experimental   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/python/data/experimental/init.py", line 96, in     from tensorflow.python.data.experimental import service   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/python/data/experimental/service/init.py", line 419, in     from tensorflow.python.data.experimental.ops.data_service_ops import distribute   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/python/data/experimental/ops/data_service_ops.py", line 22, in     from tensorflow.python.data.experimental.ops import compression_ops   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/python/data/experimental/ops/compression_ops.py", line 16, in     from tensorflow.python.data.util import structure   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/python/data/util/structure.py", line 22, in     from tensorflow.python.data.util import nest   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/python/data/util/nest.py", line 34, in     from tensorflow.python.framework import sparse_tensor as _sparse_tensor   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/python/framework/sparse_tensor.py", line 24, in     from tensorflow.python.framework import constant_op   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/python/framework/constant_op.py", line 25, in     from tensorflow.python.eager import execute   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/python/eager/execute.py", line 21, in     from tensorflow.python.framework import dtypes   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/python/framework/dtypes.py", line 34, in     _np_bfloat16 = _pywrap_bfloat16.TF_bfloat16_type() TypeError: Unable to convert function return value to a Python type! The signature was () -> handle After upgrade numpy by "pip install numpy --upgrade", I received the following error: Traceback (most recent call last):   File "", line 1, in   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/init.py", line 440, in     _ll.load_library(_plugin_dir)   File "/Users/bseo/miniconda/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/bseo/miniconda/lib/python3.9/site-packages/tensorflow-plugins/libmetal_plugin.dylib, 0x0006): Symbol not found: OBJC_CLASS$_MPSGraphRandomOpDescriptor   Referenced from: /Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow-plugins/libmetal_plugin.dylib   Expected in: /System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Versions/A/MetalPerformanceShadersGraph I also tried the solution in https://developer.apple.com/forums/thread/706219, but I still received the following error: Traceback (most recent call last):   File "", line 1, in   File "/Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow/init.py", line 440, in     _ll.load_library(_plugin_dir)   File "/Users/bseo/miniconda/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/bseo/miniconda/lib/python3.9/site-packages/tensorflow-plugins/libmetal_plugin.dylib, 0x0006): Symbol not found: OBJC_CLASS$_MPSGraphRandomOpDescriptor   Referenced from: /Users/bseo/miniconda/lib/python3.9/site-packages/tensorflow-plugins/libmetal_plugin.dylib   Expected in: /System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Versions/A/MetalPerformanceShadersGraph How can I fix this error? Many thanks in advance!
3
0
1.7k
Dec ’22