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

MAINT: backports/prep for 1.13.1 #20632

Merged

Conversation

tylerjereddy
Copy link
Contributor

@tylerjereddy tylerjereddy commented May 2, 2024

We're about 3.5 weeks from the planned branching for SciPy 1.14.x. Since 1.13.0 was a bit rushed to support NumPy 2.x, and indeed I made a few oversights for backporting, it may make sense to at least assess how much work it would be to deliver 1.13.1. I've cleaned up the backport labels a bit too, since there were almost 50 of them. Many were things I could have backported to 1.12.x, but I think that would stretch me (and reviewers/support) too thin at this point.

Backports included here (so far):

  1. BUG: sparse: align dok_array.pop() to dict.pop() for case with no default arg #20322
  2. BUG: sync pocketfft again #20333
  3. DOC: optimize: fix wrong optional argument name in root(method="lm"). #20401
  4. DOC: add missing deprecations from 1.13.0 release notes #20435
  5. MAINT/DOC: fix syntax in 1.13.0 release notes #20437
  6. DOC: remove spurious backtick from release notes #20449
  7. BUG: linalg: fix ordering of complex conj gen eigenvalues #20473
  8. TST: tolerance bumps for the conda-forge builds #20474
  9. TST: compare absolute values of U and VT in pydata-sparse SVD test #20484
  10. BUG: Include Python.h before system headers. #20505 (already covered by BLD: Move Python-including files to start of source. #20537)
  11. BUG: linalg: fix eigh(1x1 array, driver='evd') f2py check #20516
  12. BUG: spherical_in for n=0 and z=0 #20527 (danger: I applied the patch manually to the old version of the special code; I did backport the new test though, and it did fail before/pass after my manual application of a slightly different patch)
  13. BLD: Fix error message for f2py generation fail #20530
  14. update openblas to 0.3.27 #20569
  15. BUG: Fix error with 180 degree rotation in Rotation.align_vectors() with an infinite weight #20573
  16. BUG: handle uint arrays in factorial{,2,k} #20607
  17. BUG: prevent QHull message stream being closed twice #20611
  18. BUG: fix Vor/Delaunay segfaults #20633
  19. BUG: ndimage: fix origin handling for {minimum, maximum}_filter #20653
  20. MAINT: stats.yulesimon: fix kurtosis #20654
  21. BUG: sparse: Clean up 1D input handling to sparse array/matrix and add tests #20444
  22. BUG: sparse: Fix summing duplicates for CSR/CSC creation from (data,coords) #20687
  23. MAINT: added doc/source/.jupyterlite.doit.db to .gitignore See #20264 #20280
  24. MAINT: lint: temporarily disable UP031 #20601
  25. MAINT/DEV: lint: disable UP032 #20629
  26. BUG: ndimage.value_indices: deal with unfixed types #20644
  27. CI: pin Python for MacOS conda #20727
  28. TST: Adapt to __array__(copy=True) #20533
  29. MAINT: stats.wilcoxon: fix failure with multidimensional x with NaN and slice length > 50 #20592
  30. BUG: stats: Fix zipf.pmf and zipfian.pmf for int32 k #20702

Backports already merged to the release branch:

  1. REV: 1.13.x: revert changes to f2py and tempita handling in meson.build files #20567
  2. BLD: Move Python-including files to start of source. #20537

TODO:

  • perhaps deal with what I believe is NumPy copy semantics changes causing a few fails with pre-release (https://github.com/scipy/scipy/actions/runs/9102530687/job/25022358623?pr=20632), though I believe we don't really have to do that on the release branch and could also pin NumPy back a bit (maybe I'll evaluate size of patch needed locally...)
  • CI failure from CI: scipy installation failing in umfpack tests #20714 (persists in main at time of writing)
  • MAINT, TST: two types of failures observed on maintenance/1.13.x branch #20576 (at least one of those is showing up here already I think)
  • there are a few 1.13.0 performance/hang-related tickets open to keep an eye on I think (OpenBLAS and/or Qhull thread contention?)
  • gradually running more of the CI here, including wheel build flush eventually because of i.e., OpenBLAS bump
  • check for more backport candidates from the last few days
  • update the release notes again
  • read the diff carefully
  • (minor) doc/source/.jupyterlite.doit.db isn't gitignored on this branch/PR when I do the doc build (which otherwise passes at the time of writing) locally
  • backport linter suppressions for stuff like UP031 Use format specifiers ... maybe?

dschult and others added 20 commits May 1, 2024 20:21
* Fixes scipygh-20300 by syncing `pocketfft` again, this time
to completely disable `aligned_alloc`; see scipy/pocketfft#3
for details, but in short our more conservative shim
was not sufficient for `conda-forge`, so let's just do the same
thing NumPy did...

[skip cirrus] [skip circle]
This was reported to cause test failures under windows + MKL in conda-forge
cf scipy#20471
A slight tolerance violation was reported on conda-forge in
scipy#20472
A small tolerance violation reported on conda-forge
in scipy#20472
An exact equality was reported as flaky on conda-forge in
scipy#20472

The tolerance violations are of the order of fp noise (< 2e-16), and I don't
think that pickling/unpickling guarantees bit-to-bit compatibility.
In principle, this may invoke recalculations and those may be subject
to fp noise. So I think it's OK to only require allclose(atol=eps)
instead of exact equality.
tol violation observed on conda-forge on win+blis; suggested in
scipy#20474 (comment)
f2py check was just too strict;
LAPACK docs indicate that for N=1, lwork>=1 is acceptable:

*  LWORK   (input) INTEGER
*          The dimension of the array WORK.
*          If N <= 1,               LWORK must be at least 1.
*          If JOBZ = 'N' and N > 1, LWORK must be at least 2*N+1.
*          If JOBZ = 'V' and N > 1, LWORK must be at least
*                                                1 + 6*N + 2*N**2.

https://www.netlib.org/lapack/explore-3.1.1-html/ssyevd.f.html

closes scipygh-20512
Co-authored-by: Ralf Gommers <ralf.gommers@gmail.com>
…ith an infinite weight (scipy#20573)

* Fix exact rotations at 180 deg, improve near 180 deg

Comments

* Tests for exact near 180 deg rotations

* Fix tests

* Code review updates

---------

Co-authored-by: Scott Shambaugh <scottshambaugh@users.noreply.github.com>
* Apply "old version" of the patch provided
at scipygh-20527
* Update the SciPy `1.13.1` release notes following
a series of backports.

[skip cirrus]
@tylerjereddy tylerjereddy added the maintenance Items related to regular maintenance tasks label May 2, 2024
@tylerjereddy tylerjereddy added this to the 1.13.1 milestone May 2, 2024
rgommers and others added 6 commits May 15, 2024 13:38
Showed up as a linting error in an unrelated PR for me:
```
scipy/interpolate/_interpolate.py:918:30: UP032 [*] Use f-string instead of `format` call
scipy/interpolate/_interpolate.py:1972:30: UP032 [*] Use f-string instead of `format` call
```
This should not happen; the old code is fine, so this check needs to be
silenced or fixed separately. Similar to scipygh-20601.

[skip ci]
* Fixes scipygh-19423

* Add a few more `case` statements to account for
the (i.e., Windows) data types that don't have a fixed
width, and add a regression test.

[skip circle] [skip cirrus]
* some minor import fixes following a large
series of backports
* more import cleanups after backport activity
to make the linter happy
@tylerjereddy
Copy link
Contributor Author

tylerjereddy commented May 15, 2024

I've added substantially more backports and a few manual shims--we're back at parity with merged backport-labeled PRs.

Let's see where the regular CI lands. I did have to revert and unlabel one PR (gh-20643) based on local testing with clang-16 on Mac, but the rest made it in, so far. I expanded the TODO list above based on known CI failure in main, etc.

Edit: between gh-20727 and gh-20533, I suspect we'll be able to get the regular CI passing today.

thalassemia and others added 3 commits May 16, 2024 11:47
* We're seeing CI failures related to an undesirable
bump to Python `3.12` in this job, when the intention
was clearly to respect the Python version specific
in the GHA matrix. I didn't check too closely why
exactly it suddenly started happening, but some
packages weren't ready for `3.12` yet on this
job (`scikit-umfpack` in particular) and I don't
see too much harm in adding an extra pin to
respect the intention for the Python version.
* attempt to fix `M1 test - openblas` MacOS ARM CI job
based on some `gfortran` shims applied to a similar
job on `main`
@tylerjereddy
Copy link
Contributor Author

The regular CI is finally passing here (1 or 2 known flakes sometimes require restarts).

I'm going to proceed with a test pass of the wheel builds before updating the release notes again, because we may see shenanigans with the bump to OpenBLAS 0.3.27 for example.

* This is an empty commit to test the wheel
building in the above PR.

[wheel build]
@tylerjereddy
Copy link
Contributor Author

For MacOS ARM wheel failure line 13: gfortran: command not found, I may need similar shims to the regular CI Mac ARM job changes I made (based on a subset of changes from @thalassemia Acc support work I think), without backporting the full accelerate support stuff of course.

* Changes needed to get MacOS ARM wheels building
again, based on debug work on my fork.

[wheel build]
@tylerjereddy
Copy link
Contributor Author

I pushed in a patch that helped deal with the MacOS ARM wheel build issue on my fork, but now of course there's another problem with the new pythran released yesterday. Hopefully I can patch that with less friction.

tylerjereddy and others added 4 commits May 21, 2024 15:29
* Need to pin `pythran` version in a CI job
because of a recent new release.

[wheel build]
* Increase the Cirrus CI Linux aarch64
job timeout to 72 minutes; it timed
out twice in a row via manual restarts.
…) [wheel build]

* BUG: fix zipf.pmf for integer k

* ENH: increase range for zipfian.pmf for integer k

---------

Co-authored-by: Tyler Reddy <tyler.je.reddy@gmail.com>

[wheel build]
CIBW="DYLD_LIBRARY_PATH=$GFORTRAN_LIB:/opt/arm64-builds/lib delocate-listdeps {wheel} &&\
DYLD_LIBRARY_PATH=$GFORTRAN_LIB:/opt/arm64-builds/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}"
CIBW="DYLD_LIBRARY_PATH=$GFORTRAN_LIB:$LIB_PATH delocate-listdeps {wheel} &&\
DYLD_LIBRARY_PATH=$GFORTRAN_LIB:$LIB_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rgommers @h-vetinari This PR is taking shape I think--the full CI matrix (including wheels) is finally passing. The changes inline above are probably the most annoying/controversial ones I had to make manually (they are probably a superset of what is really needed to get Mac ARM wheels passing).

Any remaining objections/concerns for 1.13.1 release? We're at parity with the current list of merged backport-labeled PRs (30 in total now). I have two checklist items left above, but they are basically just updating the relnotes and reading the diff carefully before proceeding.

@mdhaber @dschult @perimosocordiae any more backports that are important for stats or sparse for 1.13.1?

I think if folks are happy I'd try to get 1.13.1 out before branching 1.14.0, with a modest delay likely for the latter, but hopefully not too substantial (I'm blocking off time for release notes work tomorrow).

Copy link
Member

Choose a reason for hiding this comment

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

Any remaining objections/concerns for 1.13.1 release? We're at parity with the current list of merged backport-labeled PRs (30 in total now).

None that I can think of. This is already quite large, so +1 for shipping it soon.

The changes for macOS gfortran should be okay - whatever works there I think is fine in a maintenance branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't get to see this earlier, but I think this has all the backports I had in mind.

@@ -19,6 +19,7 @@ cirrus_wheels_linux_aarch64_task:
platform: linux
cpu: 2
memory: 4G
timeout_in: 72m
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried restarting twice; this is probably cheaper than needing to hit restart several times during the rel process.

Copy link
Member

Choose a reason for hiding this comment

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

+1 that makes sense to me, it was always close to the limit.

@rgommers
Copy link
Member

rgommers commented May 22, 2024

I'll have a look at the Pythran issue. In the 1.13.x branch the constraint is already "pythran>=0.14.0,<0.16.0",, so the change in this PR to CI config is perfectly fine. On main it sounds like there is something to fix though.

EDIT: okay, no issue after all. It was this:

 ERROR Missing dependencies:
	pythran<0.16.0,>=0.14.0

which is expected is we do a non-isolated build and only pythran 0.16.0 is installed. So everything is fine in main too now.

* Update the SciPy `1.13.1` release notes following substantial
backport activity.

[skip cirrus]
@tylerjereddy
Copy link
Contributor Author

A new test failure showed up in a Windows CI job (https://github.com/scipy/scipy/actions/runs/9194423643/job/25287826002?pr=20632).

_________________________ TestPoisson.test_fill_space _________________________

self = <scipy.stats.tests.test_qmc.TestPoisson object at 0x000002389148B210>

    def test_fill_space(self):
        radius = 0.2
        engine = self.qmce(d=2, radius=radius)
    
        sample = engine.fill_space()
        # circle packing problem is np complex
>       assert l2_norm(sample) >= radius

C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\scipy\stats\tests\test_qmc.py:938: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\scipy\stats\tests\test_qmc.py:1410: in l2_norm
    return distance.pdist(sample).min()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

a = array([], dtype=float64), axis = None, out = None, keepdims = False
initial = <no value>, where = True

    def _amin(a, axis=None, out=None, keepdims=False,
              initial=_NoValue, where=True):
>       return umr_minimum(a, axis, None, out, keepdims, initial, where)
E       ValueError: zero-size array to reduction operation minimum which has no identity

C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\numpy\_core\_methods.py:48: ValueError
============================== warnings summary ===============================
stats/tests/test_qmc.py::TestUtils::test_geometric_discrepancy_mst_with_zero_distances
  C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\scipy\stats\tests\test_qmc.py:232: UserWarning: Sample contains duplicate points.
    assert_allclose(qmc.geometric_discrepancy(sample, method='mst'), 0.5)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ===========================
FAILED stats/tests/test_qmc.py::TestPoisson::test_fill_space - ValueError: zero-size array to reduction operation minimum which has no identity

I'm going to restart that now and hope it is a fluke (cc @tupui since it is qmc, but I don't see any reports of it flaking in our issue tracker).

Beyond that, I read through the full diff again and didn't see anything I didn't expect. The rendered versions of the 1.13.1 and 1.13.0 (also modified here) release notes don't seem to have any major issues.

@tylerjereddy
Copy link
Contributor Author

Regular CI is green again, proceeding with 1.13.1 release process.

@tylerjereddy
Copy link
Contributor Author

We have a 1.5:1 commit:backport PR ratio, which is a bit high, but I'd rather not play with commit history/fire.

@tylerjereddy tylerjereddy merged commit 2eb8e1b into scipy:maintenance/1.13.x May 22, 2024
27 checks passed
@tylerjereddy tylerjereddy deleted the treddy_prep_1_13_1_backports branch May 22, 2024 17:33
@tylerjereddy
Copy link
Contributor Author

somehow a Cirrus job still timed out at an hour or so during the rel process.. restarting it is I guess.

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

Successfully merging this pull request may close these issues.

None yet