I followed steps:https://developer.apple.com/metal/tensorflow-plugin/ and installed the tensor flow. But when I tried to import tensorflow on python in my shell I got errors,
And not installing TF to the base environment, uninstall numpy, reinstall numpy, all these methods can not work.
Appreciate your patience.
ImportError
Traceback (most recent call last)
File ~/miniforge3/lib/python3.9/site-packages/numpy/core/init.py:22, in
21 try:
---> 22 from . import multiarray
23 except ImportError as exc:
File ~/miniforge3/lib/python3.9/site-packages/numpy/core/multiarray.py:12, in
10 import warnings
---> 12 from . import overrides
13 from . import _multiarray_umath
File ~/miniforge3/lib/python3.9/site-packages/numpy/core/overrides.py:7, in
5 import textwrap
----> 7 from numpy.core._multiarray_umath import (
8 add_docstring, implement_array_function, _get_implementing_args)
9 from numpy.compat._inspect import getargspec
ImportError: dlopen(/Users/myname/miniforge3/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/libcblas.3.dylib
Referenced from: /Users/myname/miniforge3/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so
Reason: tried: '/Users/myname/miniforge3/lib/python3.9/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/myname/miniforge3/lib/python3.9/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/myname/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/Users/myname/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/usr/local/lib/libcblas.3.dylib' (no such file), '/usr/lib/libcblas.3.dylib' (no such file)
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 import tensorflow as tf
File ~/miniforge3/lib/python3.9/site-packages/tensorflow/init.py:37, in
34 import sys as _sys
35 import typing as _typing
---> 37 from tensorflow.python.tools import module_util as _module_util
38 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
40 # Make sure code inside the TensorFlow codebase can use tf2.enabled() at import.
File ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/init.py:37, in
29 # We aim to keep this file minimal and ideally remove completely.
30 # If you are adding a new file with @tf_export decorators,
31 # import it in modules_with_exports.py instead.
32
33 # go/tf-wildcard-import
34 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
36 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
---> 37 from tensorflow.python.eager import context
39 # pylint: enable=wildcard-import
40
41 # Bring in subpackages.
42 from tensorflow.python import data
File ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/eager/context.py:26, in
23 import threading
25 from absl import logging
---> 26 import numpy as np
27 import six
29 from tensorflow.core.framework import function_pb2
File ~/miniforge3/lib/python3.9/site-packages/numpy/init.py:150, in
147 # Allow distributors to run custom init code
148 from . import _distributor_init
--> 150 from . import core
151 from .core import *
152 from . import compat
File ~/miniforge3/lib/python3.9/site-packages/numpy/core/init.py:48, in
24 import sys
25 msg = """
26
27 IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
(...)
46 """ % (sys.version_info[0], sys.version_info[1], sys.executable,
47 version, exc)
---> 48 raise ImportError(msg)
49 finally:
50 for envkey in env_added:
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
The Python version is: Python3.9 from "/Users/myname/miniforge3/bin/python"
The NumPy version is: "1.21.6"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: dlopen(/Users/myname/miniforge3/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/libcblas.3.dylib
Referenced from: /Users/myname/miniforge3/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so
Reason: tried: '/Users/myname/miniforge3/lib/python3.9/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/myname/miniforge3/lib/python3.9/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/myname/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/Users/myname/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/usr/local/lib/libcblas.3.dylib' (no such file), '/usr/lib/libcblas.3.dylib' (no such file)