Skip to content

Ignore runtimewarning about ndarray size change. - #11116

Merged
pllim merged 1 commit into
astropy:masterfrom
mhvk:numpy-dev-array-size-warning
Dec 1, 2020
Merged

pllim merged 1 commit into
astropy:masterfrom
mhvk:numpy-dev-array-size-warning

Conversation

@mhvk

@mhvk mhvk commented Dec 1, 2020 •

Copy link
Copy Markdown
Contributor

I think these warnings, like for the dtype, can be ignored.

Note: Only merge if the *dev job passes again (it does locally, but one never knows...)

EDIT: Fix #11119

Comment thread setup.cfg
ignore:unclosed <socket:ResourceWarning
ignore:unclosed <ssl.SSLSocket:ResourceWarning
ignore:numpy.ufunc size changed:RuntimeWarning
ignore:numpy.ndarray size changed:RuntimeWarning

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it appears when several binary wheels compiled against different NumPy versions interact? The oldest reference I can find is numpy/numpy#563, but there's not that much information available.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, it may be definitions about ndarray inside cython. I do think that, like for the dtype, the extension of the struct that holds the definition of an array is written such that one can always use the old version.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will ignoring this have any side effects in the future? When can we remove ignoring this warning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think our code suffers only because we use cython, so at some level it is not our problem... And the thread does suggest that it it is fine to have code that relies on the old struct. So, for now I think we can simply do this...

As for when we can remove the warning: presumably whenever we have a minimum version of cython compatible with this change...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fine by me then 👍

@pllim pllim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test did pass, so fine by me as long as we open up a follow up issue to remove the ignoring of this warning (maybe even milestone to 4.3 so we don't forget).

I'll keep this open in case @saimn has more comments.

@mhvk

mhvk commented Dec 1, 2020

Copy link
Copy Markdown
Contributor Author

@pllim - see #11120

@pllim

pllim commented Dec 1, 2020

Copy link
Copy Markdown
Member

Merging. Thanks!

@pllim
pllim merged commit 7c7fa76 into astropy:master Dec 1, 2020
@mhvk
mhvk deleted the numpy-dev-array-size-warning branch December 1, 2020 17:42
@embray

embray commented Mar 15, 2021

Copy link
Copy Markdown
Member

Perhaps for now I will backport this to the v4.0.x branch as part of #11123. I agree, the issue relates to use of binary wheels for numpy and for other packages, probably most notably cython but maybe also matplotlib(?) that are compiled against a different numpy version.

@pllim

pllim commented Mar 15, 2021

Copy link
Copy Markdown
Member

@embray , I think @astrofrog is supposed to release 4.0.5, so pinging him for his info.

astrofrog pushed a commit that referenced this pull request Mar 15, 2021
Ignore runtimewarning about ndarray size change.
embray pushed a commit to pllim/astropy that referenced this pull request Mar 18, 2021
Ignore runtimewarning about ndarray size change.
eteq pushed a commit that referenced this pull request Mar 23, 2021
Ignore runtimewarning about ndarray size change.
@kidpixo

kidpixo commented Sep 23, 2021

Copy link
Copy Markdown

This still happens to me with :

  • python version : 3.8.10 | packaged by conda-forge | (default, May 11 2021, 07:01:05) | [GCC 9.3.0]
  • numpy>=1.20 (conda-forge)
  • astropy:4.3.1 (conda-forge)

I downgraded to numpy:1.19.5 and that's ok.

@pllim

pllim commented Sep 23, 2021

Copy link
Copy Markdown
Member

@kidpixo , this patch only affects pytest runs. The warning still happens if you are using astropy in a normal Python session under certain circumstances. It is up to you how you wish to handle such warning using https://docs.python.org/3/library/warnings.html

@kidpixo

kidpixo commented Sep 24, 2021 •

Copy link
Copy Markdown

@pllim ah sorry for ading noise here.
It seems I cannot handle the RuntimeWarning using the warnings module in any way.
I tried to ignore everything, but it does crashes my code. I will revert to older numpy for now.
It happens here : astropy/table/column.py > _column_mixins.pyx 1 init astropy.table._column_mixins

@pllim

pllim commented Sep 24, 2021

Copy link
Copy Markdown
Member

it does crashes my code

@kidpixo , perhaps you should open a new issue and provide the minimally reproducible example of how this warning actually crashes your code. Warning is not an exception, it should not crash anything unless you explicitly set the session to turn all warnings into exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TST: numpy-dev job failed with numpy.ndarray size changed

6 participants