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

Add support for Python 3.11, require NumPy 1.23+ #704

Merged
merged 5 commits into from
Feb 28, 2024

Conversation

jameslamb
Copy link
Member

@jameslamb jameslamb commented Feb 26, 2024

Description

Contributes to rapidsai/build-planning#3

This PR adds support for Python 3.11.

It also bumps uses of NumPy to numpy>=1.23, see rapidsai/build-planning#3 (comment).

Notes for Reviewers

This is part of ongoing work to add Python 3.11 support across RAPIDS.

The Python 3.11 CI workflows introduced in rapidsai/shared-workflows#176 are optional... they are not yet required to run successfully for PRs to be merged.

This PR can be merged once all jobs are running successfully (including the non-required jobs for Python 3.11). The CI logs should be verified that the jobs are building and testing with Python 3.11.

See rapidsai/shared-workflows#176 for more details.

@jameslamb jameslamb added do not merge non-breaking Introduces a non-breaking change improvement Improves an existing functionality labels Feb 26, 2024
@jakirkham
Copy link
Member

cc @thewtex (for awareness)

@jakirkham
Copy link
Member

It looks like the imports were reordered in a bunch of places. Is this from isort or something?

Also are there any related updates needed to .pre-commit-config.yaml?

@jameslamb
Copy link
Member Author

It looks like the imports were reordered in a bunch of places. Is this from isort or something?

All of these import-related changes were made by ruff when I ran pre-commit run --all-files.

I see the exact same changes made if I run pre-commit the way this project does in CI.

pre-commit run --hook-stage manual --all-files --show-diff-on-failure

So I'm not sure how these changes weren't previously caught in CI. All of the checks in https://github.com/rapidsai/cucim/blob/branch-24.04/.pre-commit-config.yaml are pinned to specific versions of things, so not sure what changed between #694 and now 🤔

@jameslamb jameslamb marked this pull request as ready for review February 27, 2024 15:17
@jameslamb jameslamb requested review from a team as code owners February 27, 2024 15:17
@KyleFromNVIDIA
Copy link
Contributor

https://github.com/rapidsai/cucim/actions/runs/8070438319/job/22048142083?pr=704 is failing because we're building against numpy 1.21.3, which doesn't support Python 3.11.

@jameslamb
Copy link
Member Author

because we're building against numpy 1.21.3, which doesn't support Python 3.11

Thanks for finding that!

I just did a bit of research, sharing some notes that might help inform what we do about this.

From https://numpy.org/news/#numpy-1240-released, it looks like numpy==1.24.* (December 2022) was the first one to fully support Python 3.11.

It looks like numpy==1.23.2 (August 2022) was the first to have CPython 3.11 wheels (https://pypi.org/project/numpy/1.23.2/#files).

cudf is allowing numpy to float, numpy>=1.21 (cudf/pyproject.toml).

cucim is not pinning to a specific numpy in its wheel runtime dependencies

But is pinning to numpy==1.21.* in its conda runtime dependencies

@KyleFromNVIDIA
Copy link
Contributor

It was pinned specifically to 1.21 in #480, because that's the oldest version of numpy we support.

@bdice
Copy link
Contributor

bdice commented Feb 27, 2024

But [cucim] is pinning to numpy==1.21.* in its conda runtime dependencies

⚠️ Note the dependency on numpy is in host, so it's a build dependency here, not a runtime dependency! We try to always build against the oldest supported numpy version, because numpy requires run_version >= (build or host)_version.

conda-forge is using numpy 1.23 with python 3.11: https://github.com/conda-forge/conda-forge-pinning-feedstock/blob/bd0cc0a05ae8fc09f687ca52fcdc0cf4acbb5306/recipe/conda_build_config.yaml#L694-L699

We should be able to update this pin to 1.23 wherever numpy is used as a host dependency. This also applies to some other packages like RAFT.

@jakirkham
Copy link
Member

jakirkham commented Feb 27, 2024

Yeah in Python 3.11 NumPy was bumped to 1.23

The simplest solution would be to bump to NumPy 1.23 here

If for some reason that does not work, we can use NumPy 1.21 for older Python versions and NumPy 1.23 for Python 3.11

Edit: It looks like Bradley posted this at the same time

@jameslamb
Copy link
Member Author

⚠️ Note the dependency on numpy is in host, so it's a build dependency here, not a runtime dependency

Ah yeah sorry about that, I could have chosen a better link. It's build dependency AND a runtime dependency, via this

- {{ pin_compatible('numpy') }}

right?

@jameslamb jameslamb changed the title Add support for Python 3.11 Add support for Python 3.11, require NumPy 1.23+ Feb 28, 2024
@jakirkham
Copy link
Member

/merge

@rapids-bot rapids-bot bot merged commit f4b58c7 into rapidsai:branch-24.04 Feb 28, 2024
48 checks passed
@jakirkham
Copy link
Member

Thanks all! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants