Hi,
I needed to update my numpy version to > 1.21 to be able to use another python package. My current version of numpy is 1.24 (prior to this update, numpy version was 1.19). With the previous version, my code was running without any problem. However, as soon as I updated to numpy 1.24, i cannot import tensorflow anymore. My tensorflow version is 2.6.0. My python version 3.8. I am using a mac. Below is the traceback:
Traceback (most recent call last):
Cell In[7], line 1
import tensorflow as tf
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/__init__.py:41
from tensorflow.python.tools import module_util as _module_util
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/python/__init__.py:46
from tensorflow.python import data
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/python/data/__init__.py:25
from tensorflow.python.data import experimental
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/python/data/experimental/__init__.py:97
from tensorflow.python.data.experimental import service
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/python/data/experimental/service/__init__.py:353
from tensorflow.python.data.experimental.ops.data_service_ops import distribute
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/python/data/experimental/ops/data_service_ops.py:26
from tensorflow.python.data.experimental.ops import compression_ops
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/python/data/experimental/ops/compression_ops.py:20
from tensorflow.python.data.util import structure
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/python/data/util/structure.py:26
from tensorflow.python.data.util import nest
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/python/data/util/nest.py:40
from tensorflow.python.framework import sparse_tensor as _sparse_tensor
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/python/framework/sparse_tensor.py:28
from tensorflow.python.framework import constant_op
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/python/framework/constant_op.py:29
from tensorflow.python.eager import execute
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/python/eager/execute.py:27
from tensorflow.python.framework import dtypes
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/tensorflow/python/framework/dtypes.py:585
np.object,
File ~/opt/anaconda3/envs/profiler/lib/python3.8/site-packages/numpy/__init__.py:305 in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
How do I fix it? As I said, I needed to use a package that requires numpy > 1.21 . So going back to numpy 1.19 is not an option.
Any help would be appreciated.
Thanks.