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

Update numpy to 1.24.3 #35081

Closed

Conversation

mkoeppe
Copy link
Contributor

@mkoeppe mkoeppe commented Feb 12, 2023

📚 Description

NumPy 1.24.x still supports Python 3.8 (see #35404).
https://github.com/numpy/numpy/releases

Closes #34816

📝 Checklist

  • I have made sure that the title is self-explanatory and the description concisely explains the PR.
  • I have linked an issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

@codecov-commenter
Copy link

codecov-commenter commented Feb 12, 2023

Codecov Report

Base: 88.59% // Head: 88.58% // Decreases project coverage by -0.02% ⚠️

Coverage data is based on head (6a2aeb4) compared to base (05329f6).
Patch has no changes to coverable lines.

❗ Current head 6a2aeb4 differs from pull request most recent head 4430324. Consider uploading reports for the commit 4430324 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #35081      +/-   ##
===========================================
- Coverage    88.59%   88.58%   -0.02%     
===========================================
  Files         2140     2140              
  Lines       396998   396961      -37     
===========================================
- Hits        351740   351648      -92     
- Misses       45258    45313      +55     
Impacted Files Coverage Δ
src/sage/plot/histogram.py 96.77% <ø> (-3.23%) ⬇️
src/sage/repl/ipython_extension.py 80.13% <ø> (ø)
src/sage/groups/affine_gps/euclidean_group.py 88.88% <0.00%> (-11.12%) ⬇️
...e/combinat/cluster_algebra_quiver/mutation_type.py 50.00% <0.00%> (-4.64%) ⬇️
src/sage/groups/affine_gps/affine_group.py 96.62% <0.00%> (-2.25%) ⬇️
src/sage/modular/hecke/algebra.py 94.65% <0.00%> (-1.07%) ⬇️
src/sage/schemes/elliptic_curves/hom_velusqrt.py 94.09% <0.00%> (-0.79%) ⬇️
src/sage/schemes/elliptic_curves/hom.py 83.33% <0.00%> (-0.62%) ⬇️
src/sage/sets/integer_range.py 91.41% <0.00%> (-0.51%) ⬇️
... and 22 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 12, 2023

@tornaria #34994 is merged here, but it looks like we need to take care of doctest failures due to FutureWarning: In the future np.bytes will be defined as the corresponding NumPy scalar. etc.

@mkoeppe mkoeppe added this to the sage-9.9 milestone Feb 12, 2023
@tornaria
Copy link
Contributor

@tornaria #34994 is merged here, but it looks like we need to take care of doctest failures due to FutureWarning: In the future np.bytes will be defined as the corresponding NumPy scalar. etc.

I upgraded to numpy 1.24.2 last week and I did not get any of these failures. Also, the backtraces seem to point to pythran, not sagemath, I don't install pythran with sagemath (should I? what am I missing?).

At some point I was starting to like python 3, but they really make an effort to show up. Sometimes it seems half the work is dealing with deprecation sh*t.

@tornaria
Copy link
Contributor

I installed pythran (we are on 0.12.1). Now I get stuff like

    DeprecationWarning: msvccompiler is deprecated and slated to be removed in the future. Please discontinue use or file an issue with pypa/distutils describing your use case.

No, I don't have msvc installed here, thank you very much. Uninstalling pythran.

I abhor programs that change behaviour just because some library is installed.

Also, we have these lines in src/sage/alll.py:

# Ignore numpy warnings triggered by pythran
warnings.filterwarnings('ignore', category=DeprecationWarning,
                        module='pythran

Shouldn't that apply? Btw, that's the only reference to pythran in the sage library. Why is then installing pythran having any effect at all?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 14, 2023

I'm throwing in an update of pythran to see if that helps

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 15, 2023

Yes, that fixed it.

@mkoeppe mkoeppe self-assigned this Feb 18, 2023
@kiwifb
Copy link
Member

kiwifb commented Feb 21, 2023

This now "conflicts" with #34994 which includes all the doctests fixes I think. That PR is in Volker's current merge tree. I was wondering why I could not see the fortran warnings anymore. I would support the upgrade once #34994 is merged.

@kiwifb
Copy link
Member

kiwifb commented Feb 21, 2023

The stuff in here (or #34994) doesn't fix

sage -t --random-seed=208794765845619979520719224489586219359 src/sage/plot/plot_field.py
**********************************************************************
File "src/sage/plot/plot_field.py", line 51, in sage.plot.plot_field.PlotField.__init__
Failed example:
    r.yvec_array
Expected:
    masked_array(data=[0.0, 0.70710678118..., 0.70710678118...,
                       0.89442719...],
                 mask=[False, False, False, False],
           fill_value=1e+20)
Got:
    masked_array(data=[0.        , 0.70710678, 0.70710678, 0.89442719],
                 mask=False,
           fill_value=1e+20)

and at least one similar failure in sage/plot/streamline_plot.py. Has it been attributed to something else?

@tornaria
Copy link
Contributor

The stuff in here (or #34994) doesn't fix

sage -t --random-seed=208794765845619979520719224489586219359 src/sage/plot/plot_field.py
**********************************************************************
File "src/sage/plot/plot_field.py", line 51, in sage.plot.plot_field.PlotField.__init__
Failed example:
    r.yvec_array
Expected:
    masked_array(data=[0.0, 0.70710678118..., 0.70710678118...,
                       0.89442719...],
                 mask=[False, False, False, False],
           fill_value=1e+20)
Got:
    masked_array(data=[0.        , 0.70710678, 0.70710678, 0.89442719],
                 mask=False,
           fill_value=1e+20)

and at least one similar failure in sage/plot/streamline_plot.py. Has it been attributed to something else?

I never saw anything like that.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 22, 2023

I've redone the branch on top of current #34994.

@kiwifb
Copy link
Member

kiwifb commented Feb 22, 2023

@tornaria pythran is a dependency of scipy, but it may not be useful at runtime as it is similar to cython as far as I can see. It is possible that the formatting in plot_field.py is coming from something else, but then what? And it was spotted as far back as December.

@kiwifb
Copy link
Member

kiwifb commented Feb 22, 2023

src/sage/plot/plot_field.py and sage/plot/streamline_plot.py formatting issues have disappeared by going from numpy 1.24.0 to 1.24.2. I was still on 1.24.0.

@mkoeppe mkoeppe force-pushed the t/34816/update_numpy_to_1_24 branch from 4430324 to 7830cae Compare March 28, 2023 02:10
@tornaria
Copy link
Contributor

tornaria commented Apr 4, 2023

For the record, I pushed #35438 to ignore all the deprecation warnings that I see when installing pythran (python 3.11, setuptools 67.6.1, numpy 1.24.2).

I can't really review the current PR since it's only changing a spkg, but FWIW I've been using 1.24.2 for a while without any trouble after #34994.

Copy link
Member

@kiwifb kiwifb left a comment

Choose a reason for hiding this comment

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

I have now been using 1.24.2 since the end of February without noticeable problems because of it.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Apr 4, 2023

I've merged #35438 just in case.

@mkoeppe mkoeppe force-pushed the t/34816/update_numpy_to_1_24 branch from 7830cae to ffd9ee9 Compare April 4, 2023 21:13
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Apr 23, 2023

1.24.3 is out

@mkoeppe mkoeppe force-pushed the t/34816/update_numpy_to_1_24 branch from ffd9ee9 to 0442126 Compare April 23, 2023 05:13
@mkoeppe mkoeppe changed the title Update numpy to 1.24.2 Update numpy to 1.24.3 Apr 23, 2023
@mkoeppe mkoeppe modified the milestones: sage-10.0, sage-10.1 Apr 30, 2023
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 20, 2023

numpy 1.25.0 is out, which supports Python 3.9–3.11, but not the upcoming 3.12. https://numpy.org/devdocs/release/1.25.0-notes.html
A version 1.26 is promised to provide Python 3.12 support.

@tornaria tornaria mentioned this pull request Jun 24, 2023
3 tasks
vbraun pushed a commit that referenced this pull request Jul 1, 2023
    
### 📚 Description

Mostly due to a deprecation warning:
`Conversion of an array with ndim > 0 to a scalar is deprecated, and
will error in future. Ensure you extract a single element from your
array before performing this operation. (Deprecated NumPy 1.25.)`.

Also fix:
 - a change of output in `numpy.linalg.eig()`
 - a change in an exception class

See: #35081

<!-- Please provide a concise, informative and self-explanatory title.
-->
<!-- Don't put issue numbers in the title. Put it in the Description
below. -->
<!-- For example, instead of "Fixes #12345", use "Add a new method to
multiply two integers" -->


<!-- Describe your changes here in detail. -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x
]`. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.


<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: #35826
Reported by: Gonzalo Tornaría
Reviewer(s):
@github-actions
Copy link

github-actions bot commented Jul 9, 2023

Documentation preview for this PR (built with commit aee02c6; changes) is ready! 🎉

@mkoeppe mkoeppe removed this from the sage-10.1 milestone Aug 7, 2023
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 21, 2023

v1.26.0b1 is out, with Python 3.12 support and Cython 3 compatibility (see #36110).

Let's skip this update and do 1.26

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.

Update numpy to 1.26
4 participants