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.0(.0rc2) #3460

Closed
megies opened this issue May 24, 2024 · 7 comments · Fixed by #3461
Closed

Numpy 2.0(.0rc2) #3460

megies opened this issue May 24, 2024 · 7 comments · Fixed by #3461
Labels
CI issue generally related to continuous integration installation issues with installing obspy numpy packaging issue related to our packaging efforts (e.g. conda, Debian, ...) priority: high
Milestone

Comments

@megies
Copy link
Member

megies commented May 24, 2024

Numpy 2.0 will release with some changes in behavior in June. We need to ideally adjust our code to work with it like before or pin numpy<2.

https://numpy.org/devdocs/numpy_2_0_migration_guide.html

https://mail.python.org/archives/list/numpy-discussion@python.org/thread/AACXABTJ5T44T275ISQWKGL3IIOZAYTB/

https://numpy.org/devdocs/dev/depending_on_numpy.html#numpy-2-0-specific-advice

https://tests.obspy.org/140045/

Numpy 2.0.0rc2 can be installed with conda like this (or using the new env file from the related pull request)

(base)$ conda create -n np2 python numpy==2.0.0rc2 conda-forge/label/numpy_rc::_numpy_rc obspy pytest pytest-json-report
# optionally switch to dev obspy
(base)$ conda activate np2
(np2)$ conda remove --offline --force obspy
(np2)$ pip install -e /path/to/obspy/git
@megies megies added this to the 1.5.0 milestone May 24, 2024
@megies megies added installation issues with installing obspy packaging issue related to our packaging efforts (e.g. conda, Debian, ...) CI issue generally related to continuous integration numpy priority: high labels May 24, 2024
@megies
Copy link
Member Author

megies commented May 24, 2024

As far as I understand we don't rely on numpy C API but it seems still we need to make sure wheels are built on numpy 2.x. Not sure about it though, it's quite confusing to me. Also, IIUC, we build wheels in the same environment that is used for testing in all the various matrix jobs which would mean we can't easily make sure numpy 2 is used to build wheels. Also not sure about that assessment though 🤣

There is some info here it seems how to control build env, not sure if that helps
https://cibuildwheel.pypa.io/en/v2.18.1/options/#examples_11

@megies megies mentioned this issue May 24, 2024
13 tasks
@megies
Copy link
Member Author

megies commented May 24, 2024

see conda-forge/obspy-feedstock#67

@trichter
Copy link
Member

Hi! What is the rationale behind #3461? Do you want to fix the numpy2 issues in that PR or merge it and fix the issues with subsequent PRs?

We want to fix numpy2 issues before the 1.5.0 release?

@megies
Copy link
Member Author

megies commented May 24, 2024

Hi! What is the rationale behind #3461? Do you want to fix the numpy2 issues in that PR or merge it and fix the issues with subsequent PRs?

I think just work in that PR on fixes, no real need to get the CI change into master without the fixes, I'd say

We want to fix numpy2 issues before the 1.5.0 release?

I think we should try yeah, pretty sure it's mostly trivial fixes, like manual upcasting of types and stuff like that

@QuLogic
Copy link
Member

QuLogic commented May 24, 2024

As far as I understand we don't rely on numpy C API but it seems still we need to make sure wheels are built on numpy 2.x.

I don't think that should be the case. You'd only need to build against it to get the ABI to match. It should be sufficient to ensure we test it somewhere.

@megies
Copy link
Member Author

megies commented May 25, 2024

I don't think that should be the case. You'd only need to build against it to get the ABI to match. It should be sufficient to ensure we test it somewhere.

Yeah, I read more on it and I agree, probably we're good.

@trichter probably we could attach built wheels as artifacts so we can just briefly grab one wheel built on numpy 1.x and check it locally vs numpy 2.0.0rc2

@trichter
Copy link
Member

@trichter probably we could attach built wheels as artifacts so we can just briefly grab one wheel built on numpy 1.x and check it locally vs numpy 2.0.0rc2

This is already done. You can just grab the wheels for py3.12 from the build_wheels run triggered by pushes to the master branch. If you want to download wheels for other python versions, you can add the test_wheels flag in a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI issue generally related to continuous integration installation issues with installing obspy numpy packaging issue related to our packaging efforts (e.g. conda, Debian, ...) priority: high
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants