Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which numpy versions are compatible with Tensorflow 1.14.0

Tags:

tensorflow

I'm getting warnings combining 1.14.0 with numpy 1.17.2. Do these go together? I can't find any official TF page stating compatibility requirements.

like image 907
Mastiff Avatar asked Nov 01 '19 16:11

Mastiff


People also ask

Which Numpy version is compatible with TensorFlow?

But, tensorflow requires numpy version==1.2.

Can you use Numpy with TensorFlow?

TensorFlow implements a subset of the NumPy API, available as tf. experimental. numpy . This allows running NumPy code, accelerated by TensorFlow, while also allowing access to all of TensorFlow's APIs.

How do I check Numpy version in Anaconda prompt?

Make sure you are using the Anaconda prompt, as the conda command only works in an Anaconda environment, and type conda list numpy . The result will show the version of numpy and associated packages.


2 Answers

Please downgrade numpy version from 1.17.2 to 1.16.4 will resolve issue with Tensorflow 1.14.0

Here am able to replicate issue

import tensorflow as tf
print(tf.__version__)
import numpy as np
print(np.__version__)

Output:

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])

1.14.0
1.17.2

To fix this, please execute below code to downgrade numpy to 1.16.4

pip uninstall numpy
pip install numpy==1.16.4

After that, please restart your runtime and execute below code

import tensorflow as tf
print(tf.__version__)
import numpy as np
print(np.__version__)

Output:

1.14.0
1.16.4
like image 139
Tensorflow Warrior Avatar answered Sep 19 '22 10:09

Tensorflow Warrior


Those who are looking for tensorflow2 and numpy compatible versions. They work fine together.

Tensorflow 2.4.1
numpy 1.19.5
like image 32
Santosh K Avatar answered Sep 18 '22 10:09

Santosh K