After updating my Numpy
and Tensorflow
I am getting these kind of warnings. I had already tried these, but nothing works, every suggestion will be
None of the above worked in my case and I did not want to downgrade any package.
There is a straightforward solution on Github, just suppress the warning:
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore",category=FutureWarning)
import numpy as np
import tensorflow as tf
import h5py as h5py
and then import whatever package causes the error (numpy, tensorflow, h5py
) within the scope of the with
statement
Upgrade scipy to rif of from this warning. To do this you may use pip to upgrade scipy.
**sudo pip install --upgrade scipy**
You need to upgrade h5py and numpy version should be <1.17:
pip install --upgrade h5py
pip install "numpy<1.17"
I fixed this issue by installing/reinstalling ipykernel:
pip3 install --upgrade ipykernel
If you have different pip of course us that one
You may want to find out the cause first (most answers here work for specific scenarios - libraries using deprecated features - in this case of NumPy).
In short, something did call:
np.issubdtype(something, float)
instead of:
np.issubdtype(something, np.floating)
This is done in assertions and logic dispatching code, which is rarely written by end users. So - often this will be something done by a library you're using.
So you should find out what caused this warning. You'll use the warnings
module, but in an opposite way than in other answers:
import warnings
warnings.filterwarnings('error')
# run rest of your code here
This will give you not just the warning, but an error and stack trace. Then - you're golden:
Traceback (most recent call last):
File (...)
# user code snipped...
File "C:\...\site-packages\vtk\util\numpy_support.py", line 137, in numpy_to_vtk
assert not numpy.issubdtype(z.dtype, complex), \
File "C:\...\site-packages\numpy\core\numerictypes.py", line 422, in issubdtype
FutureWarning, stacklevel=2
FutureWarning: Conversion of the second argument of issubdtype from `complex` to `np.complexfloating` is deprecated.
In future, it will be treated as `np.complex128 == np.dtype(complex).type`.
Here you see that it was VTK this time. Which of course is unlikely to be your specific problem, but after knowing what raises this warning you can do many useful things: