Import tensorflow runtime error with tensorflow-deps 2.9.0, tensorflow-macos 2.11.0, tensorflow-metal 0.7.1

I have done a fresh installation without forcing any package version, so what I got were the default ones. I installed miniconda3 first. This is the tensorflow suite that I got:

tensorflow-deps      2.9.0            
tensorflow-estimator   2.11.0       
tensorflow-macos     2.11.0       
tensorflow-metal     0.7.1      

python version 3.10

When I import tensorflow I get this runtime error about a wrong version of Numpy.:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
ImportError: numpy.core._multiarray_umath failed to import

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
ImportError: numpy.core.umath failed to import

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[1], line 1
----> 1 import tensorflow

File ~/miniconda3/envs/tensorm1/lib/python3.10/site-packages/tensorflow/__init__.py:37
     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 ~/miniconda3/envs/tensorm1/lib/python3.10/site-packages/tensorflow/python/__init__.py:42
     37 from tensorflow.python.eager import context
     39 # pylint: enable=wildcard-import
     40 
     41 # Bring in subpackages.
---> 42 from tensorflow.python import data
     43 from tensorflow.python import distribute
     44 # from tensorflow.python import keras

File ~/miniconda3/envs/tensorm1/lib/python3.10/site-packages/tensorflow/python/data/__init__.py:21
     15 """`tf.data.Dataset` API for input pipelines.
     16 
     17 See [Importing Data](https://tensorflow.org/guide/data) for an overview.
     18 """
     20 # pylint: disable=unused-import
---> 21 from tensorflow.python.data import experimental
     22 from tensorflow.python.data.ops.dataset_ops import AUTOTUNE
     23 from tensorflow.python.data.ops.dataset_ops import Dataset

File ~/miniconda3/envs/tensorm1/lib/python3.10/site-packages/tensorflow/python/data/experimental/__init__.py:96
     15 """Experimental API for building input pipelines.
     16 
     17 This module contains experimental `Dataset` sources and transformations that can
   (...)
     92 @@UNKNOWN_CARDINALITY
     93 """
     95 # pylint: disable=unused-import
---> 96 from tensorflow.python.data.experimental import service
     97 from tensorflow.python.data.experimental.ops.batching import dense_to_ragged_batch
     98 from tensorflow.python.data.experimental.ops.batching import dense_to_sparse_batch

File ~/miniconda3/envs/tensorm1/lib/python3.10/site-packages/tensorflow/python/data/experimental/service/__init__.py:419
      1 # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
   (...)
     13 # limitations under the License.
     14 # ==============================================================================
     15 """API for using the tf.data service.
     16 
     17 This module contains:
   (...)
    416   job of ParameterServerStrategy).
    417 """
--> 419 from tensorflow.python.data.experimental.ops.data_service_ops import distribute
    420 from tensorflow.python.data.experimental.ops.data_service_ops import from_dataset_id
    421 from tensorflow.python.data.experimental.ops.data_service_ops import register_dataset

File ~/miniconda3/envs/tensorm1/lib/python3.10/site-packages/tensorflow/python/data/experimental/ops/data_service_ops.py:22
     20 from tensorflow.core.protobuf import data_service_pb2
     21 from tensorflow.python import tf2
---> 22 from tensorflow.python.data.experimental.ops import compression_ops
     23 from tensorflow.python.data.experimental.service import _pywrap_server_lib
     24 from tensorflow.python.data.experimental.service import _pywrap_utils

File ~/miniconda3/envs/tensorm1/lib/python3.10/site-packages/tensorflow/python/data/experimental/ops/compression_ops.py:16
      1 # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
   (...)
     13 # limitations under the License.
     14 # ==============================================================================
     15 """Ops for compressing and uncompressing dataset elements."""
---> 16 from tensorflow.python.data.util import structure
     17 from tensorflow.python.ops import gen_experimental_dataset_ops as ged_ops
     20 def compress(element):

File ~/miniconda3/envs/tensorm1/lib/python3.10/site-packages/tensorflow/python/data/util/structure.py:22
     18 import itertools
     20 import wrapt
---> 22 from tensorflow.python.data.util import nest
     23 from tensorflow.python.framework import composite_tensor
     24 from tensorflow.python.framework import ops

File ~/miniconda3/envs/tensorm1/lib/python3.10/site-packages/tensorflow/python/data/util/nest.py:34
      1 # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
   (...)
     13 # limitations under the License.
     14 # ==============================================================================
     16 """## Functions for working with arbitrarily nested sequences of elements.
     17 
     18 NOTE(mrry): This fork of the `tensorflow.python.util.nest` module
   (...)
     31    arrays.
     32 """
---> 34 from tensorflow.python.framework import sparse_tensor as _sparse_tensor
     35 from tensorflow.python.util import _pywrap_utils
     36 from tensorflow.python.util import nest

..................


TypeError: Unable to convert function return value to a Python type! The signature was
	() -> handle
code-block

I have tried to upgrade and downgrade numpy. I also tried different combinations of version of tensorflow-deps, -macos and -metal. All of that failed.

The initial installation is the default one though, so it should work......

Any suggestions?

Hi @gppower, can you please try: pip3 install numpy --upgrade --ignore-installed

Import tensorflow runtime error with tensorflow-deps 2.9.0, tensorflow-macos 2.11.0, tensorflow-metal 0.7.1
 
 
Q