Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tensorflow + numpy compatibility? #31249

Closed
jiapei100 opened this issue Aug 1, 2019 · 19 comments

Comments

@jiapei100
Copy link

@jiapei100 jiapei100 commented Aug 1, 2019

➜  ~ pip show tensorflow
pipName: tensorflow
Version: 1.14.0
➜  ~ pip show numpy
Name: numpy
Version: 1.17.0
>>> import tensorflow as tf
~/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: 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)])
~/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: 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)])
~/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: 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)])
~/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: 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)])
~/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: 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)])
~/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: 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)])
@ymodak

This comment has been minimized.

Copy link
Contributor

@ymodak ymodak commented Aug 1, 2019

Do you have multiple versions of numpy installed in your system?
pip show numpy
Can you uninstall all numpy versions and later install numpy==1.16.4?
pip uninstall numpy (till you uninstall all versions)
pip install numpy==1.16.4

@jiapei100

This comment has been minimized.

Copy link
Author

@jiapei100 jiapei100 commented Aug 1, 2019

@ymodak

I manually upgraded numpy:

pip install -U numpy --user

to ~/.local/lib/python3.7/site-packages

And, yes, I happened to notice I've got python3-numpy installed as well, from Ubuntu repository.

Did tensorflow find python3-nump from repository and had it installed automatically? I specified PYTHONPATH to ~/.lcoal/lib/python3/site-packages already.

Cheers

@anjakuchenbecker

This comment has been minimized.

Copy link

@anjakuchenbecker anjakuchenbecker commented Aug 2, 2019

@ymodak :
Same issue for me after fresh python and tensorflow installation (tensorflow 1.14.0 and numpy 1.17.0) from today morning.
had only one numpy installation. but after uninstallation of 1.17.0 and installation of 1.16.4 the Future Warnings are gone. Thank you!

@gadagashwini

This comment has been minimized.

Copy link

@gadagashwini gadagashwini commented Aug 2, 2019

@jiapei100 Can you please let us know if you are happy to close if no issue persists. Thanks!

@vrsheen

This comment has been minimized.

Copy link

@vrsheen vrsheen commented Aug 4, 2019

For me the warning got resolved after doing the below 2:

  1. pip install scikit-learn

  2. pip install tensorflow-datasets

@fatemehtorki

This comment has been minimized.

Copy link

@fatemehtorki fatemehtorki commented Aug 4, 2019

@ymodak
Same issue happened to me with (tensorflow 1.9.0 and numpy 1.17.0)
after uninstall of 1.17.0 and installation of 1.16.4 the Future Warnings are gone. Thank you so much!

Can you help me for solve another issue?
after i load model ,when i predicted this error is occur (Tensor Tensor("dense_2/Softmax:0", shape=(?, 2), dtype=float32) is not an element of this graph) .
What do you think I should do...

@IanQS

This comment has been minimized.

Copy link

@IanQS IanQS commented Aug 5, 2019

@fatemehtorki

You should open a new issue for that error since it is unrelated to this error

@pedro-w

This comment has been minimized.

Copy link

@pedro-w pedro-w commented Aug 5, 2019

Please can you advise, it it the intention to update Tensorflow 1.x so that these warnings won't occur in numpy 1.17 and later? Or will we always have to stick at 1.16.4?

@mihaimaruseac

This comment has been minimized.

Copy link
Contributor

@mihaimaruseac mihaimaruseac commented Aug 5, 2019

See #30559 Next release will have the issue solved

@sudonto

This comment has been minimized.

Copy link

@sudonto sudonto commented Aug 7, 2019

@fatemehtorki
You may ask in stackoverflow for that

@Mubasher0331

This comment has been minimized.

Copy link

@Mubasher0331 Mubasher0331 commented Aug 9, 2019

hello i have the same issue as jiapi i have the same versions of numpy and tensor flow please tell its solution

@Frozoto1

This comment has been minimized.

Copy link

@Frozoto1 Frozoto1 commented Aug 11, 2019

@ymodak It's helpful, thank you!

@thehayat

This comment has been minimized.

Copy link

@thehayat thehayat commented Aug 21, 2019

I'm a bit new @ymodak @jiapei100.
I have
numpy 1.16.4 tensorflow 1.14.0 tensorflow-gpu 1.14.0 keras 2.2.4 keras -Applications 1.0.8 Keras-Preprocessing 1.1.0
I am trying CNN and my jupyter is crashing on executing.
bottleneck_features_train = vgg16.predict_generator(generator, predict_size_train)

Please help I think its a compatibility issue.

Full code link.

image

zh794390558 added a commit to didi/delta that referenced this issue Aug 29, 2019
@ganesh-ms

This comment has been minimized.

Copy link

@ganesh-ms ganesh-ms commented Sep 25, 2019

I'm a bit new @ymodak @jiapei100.
I have
numpy 1.16.4 tensorflow 1.14.0 tensorflow-gpu 1.14.0 keras 2.2.4 keras -Applications 1.0.8 Keras-Preprocessing 1.1.0
I am trying CNN and my jupyter is crashing on executing.
bottleneck_features_train = vgg16.predict_generator(generator, predict_size_train)

Please help I think its a compatibility issue.

Full code link.

image

Your Tensorflow is not properly installed. Try installing it again.

@SamiEzz

This comment has been minimized.

Copy link

@SamiEzz SamiEzz commented Oct 20, 2019

I had the same problem in my linux laptop with tensorflow in python3 v3.6
Actually, you just need to change some lines in 2 files :

  • 1

`~/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py

now change this code : (line 516)


_np_qint8 = np.dtype([("qint8", np.int8, 1)])
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
_np_qint32 = np.dtype([("qint32", np.int32, 1)])


# _np_bfloat16 is defined by a module import.

# Custom struct dtype for directly-fed ResourceHandles of supported type(s).
np_resource = np.dtype([("resource", np.ubyte, 1)])

by this code :


_np_qint8 = np.dtype([("qint8", np.int8, (1,))])
_np_quint8 = np.dtype([("quint8", np.uint8, (1,))])
_np_qint16 = np.dtype([("qint16", np.int16, (1,))])
_np_quint16 = np.dtype([("quint16", np.uint16, (1,))])
_np_qint32 = np.dtype([("qint32", np.int32, (1,))])

# _np_bfloat16 is defined by a module import.

# Custom struct dtype for directly-fed ResourceHandles of supported type(s).
np_resource = np.dtype([("resource", np.ubyte, (1,))])

you have to do the same on this file :

~/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py

wubbalubadubdub

@mattc-eostar

This comment has been minimized.

Copy link

@mattc-eostar mattc-eostar commented Oct 21, 2019

@SamiEzz
Is this dependent on a particular version of numpy? I am currently using 1.16.4, but 1.17.0 should be fine with TF2.0.0 right?

@SamiEzz

This comment has been minimized.

Copy link

@SamiEzz SamiEzz commented Oct 21, 2019

@SamiEzz
Is this dependent on a particular version of numpy? I am currently using 1.16.4, but 1.17.0 should be fine with TF2.0.0 right?

I had this issue with the latest version of numpy ('1.17.3')

@gadagashwini

This comment has been minimized.

Copy link

@gadagashwini gadagashwini commented Oct 22, 2019

@mattc-eostar and @SamiEzz, Please use numpy 1.16.5 version. Thanks!

@michalisfrangos

This comment has been minimized.

Copy link

@michalisfrangos michalisfrangos commented Oct 24, 2019

Thought to mention a related issue #30120:

The use of the numpy (1.17.3) together and latest tf-nightly, causes the error of discussion in #30120

  • SOLUTION : install previous version of numpy 1.16.4

  • tensorlfow version : 2.1.0-dev20191023

  • numpy: 1.17.3 (install the previous version 1.16.4)

  • python: 3.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.