8000 RuntimeWarning for np.array with NaN · Issue #11029 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

RuntimeWarning for np.array with NaN #11029

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

Closed
chapochn opened this issue May 1, 2018 · 10 comments
Closed

RuntimeWarning for np.array with NaN #11029

chapochn opened this issue May 1, 2018 · 10 comments

Comments

@chapochn
Copy link
chapochn commented May 1, 2018

When i run the code
A = np.full(7, np.nan)
there is no issue.

When i run
A = np.full(8, np.nan)
and for any array larger than that, i get the warnings:

/mnt/home/[...]/anaconda3/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
return umr_minimum(a, axis, None, out, keepdims)
/mnt/home/[...]/anaconda3/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
return umr_maximum(a, axis, None, out, keepdims)

i use spyder 3.2.6, python 3.6.4, numpy 1.14.0
I have this warning on one of my computers (running CentOS Linux 7), but not on the other (running Ubuntu 16.04)
Cannot figure out where the different comes from. Any ideas?

@tzickel
Copy link
tzickel commented May 2, 2018

Might be related to #10370

@tzickel
Copy link
tzickel commented May 3, 2018

Did you install numpy from pip install or using the package manager of your distribution (in both cases)

@mattip
Copy link
Member
mattip commented May 4, 2018

This seems strange to me, can anyone reproduce? np.full() should not be calling umr_minimum, umr_maximum. Perhaps there is something else going on with the way Spyder is displaying A in its workspace browser, which is calling np.min(A), np.max(A), which indeed would connect it to #10370 and pr #11043 ?

@mattip
Copy link
Member
mattip commented May 4, 2018

Reliably displaying RuntimeWarning on reduce operations involving NAN cause a regression in spyder. Reported to the spyder issue tracker

@mattip
Copy link
Member
mattip commented May 4, 2018

How do we label third-party issues reported here?

@chapochn
Copy link
Author
chapochn commented May 4, 2018

@tzickel i installed in both cases using anaconda.
It seems it is indeed a spyder related issue, as when i run the same commands in an ipython terminal, no warning appears

@NotSqrt
Copy link
NotSqrt commented Jun 8, 2018

I reported the same difference 7 vs 8 in #10370 (comment)

@NotSqrt
Copy link
NotSqrt commented Jun 8, 2018

Until numpy==1.14.3, there was no RuntimeWarning for numpy.min(numpy.full((7,), numpy.nan, dtype=numpy.float64)).

With numpy==1.14.4, there's a RuntimeWarning for that case.

@mattip
Copy link
Member
mattip commented Jun 8, 2018

There was a bug that not only didn't warn, it sometimes and on some platforms ignored the nan. The warning is needed whenever we propagate an invalid value, no? It is up to the user to ignore those (or not) using any of the warning handling mechanisms in python or numpy.seterr

@mattip
Copy link
Member
mattip commented Aug 10, 2018

The issue was in spyder, and was fixed there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0