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

numpy 2 compat: tests failing with default print options #16423

Closed
neutrinoceros opened this issue May 9, 2024 · 20 comments
Closed

numpy 2 compat: tests failing with default print options #16423

neutrinoceros opened this issue May 9, 2024 · 20 comments

Comments

@neutrinoceros
Copy link
Contributor

neutrinoceros commented May 9, 2024

We currently have about 400 tests that don't pass against numpy 2.0 if we remove the following line

np.set_printoptions(legacy="1.25")

90% of the solution is already isolated in #16416, and we can probably extract backportable solutions for the other 10% from #15065.

I'm seeing ~400 failures (doctests included) on main, 90% of which are resolved by #16416, but not all of what's left are doctests, which, as discussed in #15095, are not critical and can be post-poned to after numpy 2.0.0 final comes out (supposedly this would be for astropy 7.0.0)

Everything that's not a doctest, and not already fixed in #16416, should probably be addressed for 6.1.1

Affected modules:

I expect solutions were already found by @mhvk in #15065, so it's mostly a matter of making targeted cherry-picks.

@neutrinoceros neutrinoceros changed the title numpy 2 compat: numpy 2 compat: tests failing with default print options May 9, 2024
@neutrinoceros
Copy link
Contributor Author

note for later: I think one of the failures we got in utils is showing an discrepency between how masked arrays are represented (repr) with respect to ordinary arrays in numpy 2.0. This may be something to report upstream but I need to dig further.

@mhvk
Copy link
Contributor

mhvk commented May 9, 2024

Maybe an idea is to merge #15065 for main, and then backport pieces of that? In any case, it seems sensible for me to rebase that...

@neutrinoceros
Copy link
Contributor Author

Actually what I'm finding out thusfar is that the failures I'm pointing to in this issue are not resolved by #15065, and require their own solution. Since they are related but separable problems, I don't think we need to discuss this here.

@pllim

This comment was marked as resolved.

@mhvk
Copy link
Contributor

mhvk commented May 9, 2024

@neutrinoceros - in rebasing #15065, I found test failures with pandas which are not representation-related. Are those among those you are thinking of? Also, if bottleneck is installed, some representations from sigma clipping look different...

@pllim
Copy link
Member

pllim commented May 9, 2024

Re: #16423 (comment)

Nevermind, I just saw #15095 (comment)

@neutrinoceros
Copy link
Contributor Author

re #16423 (comment):
I'm now thinking the bug is actually on our side, specifically in MaskedFormat.__call__, but I don't have time to fix it just now. VOTable failures are also a puzzle and are possibly related, so I think utils.masked should be the next priority. I'll come back to it later today if time allows.

@neutrinoceros
Copy link
Contributor Author

Upon a closer look at #15065, it seems that it already has solutions for both utils (d84166e) and votable (940e5e7).
Unless we changed our minds about waiting for numpy 2.0 final to merge #15065, I think these ought to be cherry-picked and backported. What do you think @mhvk ?

@mhvk
Copy link
Contributor

mhvk commented May 12, 2024

I actually wondered about whether we shouldn't just merge #15065 for main, and then backport the commits that do not have to do with the documentation (i.e., docs for 6.1 stay at numpy < 2.0 format). Though perhaps effectively that is the same amount of work...

@neutrinoceros
Copy link
Contributor Author

I think it's very much a comparable effort and not a big undertaking for us two, but the cherry-picking approach should make reviewing easier. If you agree to it, it shouldn't take me long to finish cherry picking the user-facing parts (only two more PRs).

@mhvk
Copy link
Contributor

mhvk commented May 12, 2024

OK, let's go that route - then #15065 will probably get in when numpy 2.0 is out (just saw rc2 was released).

@neutrinoceros
Copy link
Contributor Author

Done with #16442 and #16443

@neutrinoceros
Copy link
Contributor Author

numpy 2.0 has a release date: numpy/numpy#24300 (comment)

I'd recommend merging the remaining PRs related to this issue and cutting a 6.1.1 release before june 16th
FYI @astrofrog @saimn @mhvk @pllim

@pllim
Copy link
Member

pllim commented May 22, 2024

So is it just #16427 and #16433 left?

@neutrinoceros
Copy link
Contributor Author

Yes !

@pllim
Copy link
Member

pllim commented May 23, 2024

When they are all in, do we need a follow-up issue to get rid of without_legacy_printoptions in the future? Or do we already have such issue?

@neutrinoceros
Copy link
Contributor Author

neutrinoceros commented May 23, 2024

I don't expect it to get in the way of anyone so it should be very low priority, but I do have a personal reminder to clean it up when the time comes.
That said, your phrasing seems to imply that not having an issue isn't an option, so let me open one now :)

update: #16491

@pllim
Copy link
Member

pllim commented May 23, 2024

imply that not having an issue isn't an option

Well, I can't arrest you or anything... 😸 Thanks for opening the issue! It is good to have it out in the open to show people we're aware of it.

@neutrinoceros
Copy link
Contributor Author

neutrinoceros commented May 23, 2024

I can't arrest you or anything

Let's call it making me an offer I can't refuse 🤌🏻

@neutrinoceros
Copy link
Contributor Author

Alright, everything was merged, let's close this ! thanks !

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

No branches or pull requests

3 participants