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

Remove NumPy <2 pin #1441

Open
wants to merge 13 commits into
base: branch-24.10
Choose a base branch
from
Open

Conversation

seberg
Copy link

@seberg seberg commented Aug 19, 2024

This PR removes the NumPy<2 pin which is expected to work for
RAPIDS projects once CuPy 13.3.0 is released (CuPy 13.2.0 had
some issues preventing the use with NumPy 2).

@seberg seberg added non-breaking Non-breaking change improvement Improvement / enhancement to an existing function labels Aug 19, 2024
@github-actions github-actions bot added conda Related to conda and conda configuration Python Related to Python code labels Aug 19, 2024
@bdice
Copy link
Contributor

bdice commented Aug 21, 2024

I merged in the upstream to see if CI is failing in the same way we see here: rapidsai/docker#709 (comment)

@jakirkham jakirkham closed this Aug 24, 2024
@jakirkham jakirkham reopened this Aug 24, 2024
@jakirkham
Copy link
Member

Closing and reopening to restart CI now that cuDF is done: rapidsai/cudf#16300

@jakirkham jakirkham marked this pull request as ready for review August 24, 2024 05:53
@jakirkham jakirkham requested a review from a team as a code owner August 24, 2024 05:53
@jakirkham
Copy link
Member

jakirkham commented Aug 24, 2024

Seeing some unexpected and unrelated failures that appear to be due to a cuDF change

Running CI in a no change PR to see if this reproduces there: #1444

Edit: Seeing the same error over there ( #1444 (comment) ). Following up separately

@jakirkham
Copy link
Member

On the Conda side, it looks like we are still seeing NumPy 1 in CI.

numpy                     1.26.4          py311h64a7726_0    conda-forge

Think we are missing another dependency. Will need to take a closer look

@jakirkham
Copy link
Member

Took all of the dependencies on CI (except RAPIDS ones) and tried to create a Conda environment with them locally on Linux ARM (though there should be no difference between x86_64 in this regard). It created the environment using NumPy 2

Didn't see anything obviously missing in this repo

The other RAPIDS dependencies are all migrated

Not sure what we are missing. May need to dig deeper later

@jameslamb
Copy link
Member

Edit: Seeing the same error over there ( #1444 (comment) ). Following up separately

Strongly suspect this is a result of the changes from rapidsai/cudf#15483.

I'll work on adapting cuspatial to account for those, but going to wait just a bit until rapidsai/cudf#16640 is merged.

@jakirkham
Copy link
Member

Depends on PR: #1447

rapids-bot bot pushed a commit that referenced this pull request Aug 29, 2024
Contributes to rapidsai/build-planning#33.

Proposes the following for `cuspatial` wheels:

* add build and runtime dependencies on `libcudf` wheels
* stop vendoring copies of `libcudf.so`, `libnvcomp.so`, `libnvcomp_bitcomp.so`, and `libnvcomp_gdeflate.so`
  - *(load `libcudf.so` dynamically at runtime instead)*

And other related changes for development/CI:

* combine all `pip install` calls into 1 in wheel-testing scripts
  - *like rapidsai/cudf#16575
  - *to improve the chance that packaging issues are discovered in CI*
* `dependencies.yaml` changes:
   - more use of YAML anchors = less duplication
   - use dedicated `depends_on_librmm` and `depends_on_libcudf` groups
* explicitly pass a package type to `gha-tools` wheel uploading/downloading scripts

## Notes for Reviewers

### Benefits of these changes

Unblocks CI in this repo (ref: #1444 (comment), #1441 (comment)).

Reduces wheel sizes for `cuspatial` wheels by about 125MB 😁 

| wheel          | size (before)  | size (this PR) |
|:-----------:|-------------:|---------------:|
| `cuspatial` |   146.0M        |   21M               |
| `cuproj `     |       0.9M       |   0.9M              |
|**TOTAL**   |  **146.9M** | **21.9M**        |

*NOTES: size = compressed, "before" = 2024-08-21 nightlies (c60bd4d), CUDA = 12, Python = 3.11*

<details><summary>how I calculated those (click me)</summary>

```shell
# note: 2024-08-21 because that was the most recent date with
#           successfully-built cuspatial nightlies
#
docker run \
    --rm \
    -v $(pwd):/opt/work:ro \
    -w /opt/work \
    --network host \
    --env RAPIDS_NIGHTLY_DATE=2024-08-21 \
    --env RAPIDS_NIGHTLY_SHA=c60bd4d \
    --env RAPIDS_PR_NUMBER=1447 \
    --env RAPIDS_PY_CUDA_SUFFIX=cu12 \
    --env RAPIDS_REPOSITORY=rapidsai/cuspatial \
    --env WHEEL_DIR_BEFORE=/tmp/wheels-before \
    --env WHEEL_DIR_AFTER=/tmp/wheels-after \
    -it rapidsai/ci-wheel:cuda12.5.1-rockylinux8-py3.11 \
    bash

mkdir -p "${WHEEL_DIR_BEFORE}"
mkdir -p "${WHEEL_DIR_AFTER}"

py_projects=(
    cuspatial
    cuproj
)

for project in "${py_projects[@]}"; do
    # before
    RAPIDS_BUILD_TYPE=nightly \
    RAPIDS_PY_WHEEL_NAME="${project}_${RAPIDS_PY_CUDA_SUFFIX}" \
    RAPIDS_REF_NAME="branch-24.10" \
    RAPIDS_SHA=${RAPIDS_NIGHTLY_SHA} \
        rapids-download-wheels-from-s3 python "${WHEEL_DIR_BEFORE}"

    # after
    RAPIDS_BUILD_TYPE=pull-request \
    RAPIDS_PY_WHEEL_NAME="${project}_${RAPIDS_PY_CUDA_SUFFIX}" \
    RAPIDS_REF_NAME="pull-request/${RAPIDS_PR_NUMBER}" \
        rapids-download-wheels-from-s3 python "${WHEEL_DIR_AFTER}"
done

du -sh ${WHEEL_DIR_BEFORE}/*
du -sh ${WHEEL_DIR_BEFORE}
du -sh ${WHEEL_DIR_AFTER}/*
du -sh ${WHEEL_DIR_AFTER}
```

</details>

Reduces the amount of additional work required to start shipping `libcuspatial` wheels.

### Background

This is part of ongoing work towards packaging `libcuspatial` as a wheel.

relevant prior work:

* packaging `libcudf` wheels: rapidsai/cudf#15483
* consolidating `pip install` calls in CI scripts for `cudf`: rapidsai/cudf#16575
* `cudf` dropping its Arrow library dependency: rapidsai/cudf#16640

### How I tested this

Confirmed in local builds and CI logs that `cudf` is being *found*, not *built*, in `cuspatial` builds.

```text
-- CPM: Using local package [email protected]
```

([build link](https://github.com/rapidsai/cuspatial/actions/runs/10602971716/job/29386288614?pr=1447#step:9:23472))

Built `cuspatial` wheels locally and ran all the unit tests, without issue.

#

Authors:
  - James Lamb (https://github.com/jameslamb)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Matthew Roeschke (https://github.com/mroeschke)

URL: #1447
@jameslamb
Copy link
Member

#1447 is merged and I've pulled in those changes here

@jakirkham
Copy link
Member

jakirkham commented Aug 30, 2024

Ok think I understand what is happening with NumPy 1 being installed on CI now, OSMnx 1.9.4 (currently latest) pins to NumPy 1

IIUC OSMnx 2.0 will relax this constraint

I don't think there is a lot we can do about that

Looking at the code here, it appears the cuSpatial library doesn't actually use OSMnx. Only the notebooks do

Perhaps there is a way to move that dependency out of the main CI paths so we can test with NumPy 2 here (ignoring notebooks which will have to stay on NumPy 1)

Think if we can do that, we can move forward

Edit: Nvm this is already only installed in the notebook job. So this is not an issue

@jakirkham
Copy link
Member

Should add another piece is rasterio needs a sufficiently recent package build to pickup up NumPy 2 support: conda-forge/rasterio-feedstock#299

This can only happen if proj 9.4 is installed. However we were constraining proj to 9.3. James proposed relaxing that in PR ( #1449 ), which is now merged

While rasterio is not a direct dependency, it does get pulled in through other dependencies we have in the spatial packages. So James fix should also help relax pinnings for NumPy 2 to more easily be picked up

Copy link
Member

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

I just checked, and looks like the conda-python-tests jobs are still pulling in numpy==1.26.4 at runtime:

https://github.com/rapidsai/cuspatial/actions/runs/10626040400/job/29457392459?pr=1441#step:7:468

wheel-tests-cuspatial are pulling in numpy==2.0.2

https://github.com/rapidsai/cuspatial/actions/runs/10626040400/job/29457234502?pr=1441#step:8:1006

wheel-tests-cuproj also pulling in numpy==2.0.2

https://github.com/rapidsai/cuspatial/actions/runs/10626040400/job/29457234993?pr=1441#step:8:1009

This PR is up to date with latest branch-24.10 (so includes the proj pin removal from #1449 and other packaging changes). I think we need to figure out what else is holding numpy under 2.0. @jakirkham @seberg I'm going to push a commit here changing these pins to numpy>=2.1.0,<3.0a0 just to hopefully get more direct information about this via solver errors.

@jameslamb
Copy link
Member

jameslamb commented Aug 30, 2024

In the wheel builds, looks to me like pip is backtracking on cupy-cuda12x

Collecting cupy-cuda12x>=12.0.0 (from cudf-cu12==24.10.*,>=0.0.0a0->cuspatial-cu12==24.10.0a43->cuspatial-cu12==24.10.0a43)
  Downloading cupy_cuda12x-13.2.0-cp310-cp310-manylinux2014_x86_64.whl.metadata (2.7 kB)
INFO: pip is still looking at multiple versions of numba to determine which version is compatible with other requirements. This could take a while.
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
  Downloading cupy_cuda12x-13.1.0-cp310-cp310-manylinux2014_x86_64.whl.metadata (2.7 kB)
INFO: pip is looking at multiple versions of cupy-cuda12x to determine which version is compatible with other requirements. This could take a while.
  Downloading cupy_cuda12x-13.0.0-cp310-cp310-manylinux2014_x86_64.whl.metadata (2.6 kB)
  Downloading cupy_cuda12x-12.3.0-cp310-cp310-manylinux2014_x86_64.whl.metadata (2.7 kB)
  Downloading cupy_cuda12x-12.2.0-cp310-cp310-manylinux2014_x86_64.whl.metadata (2.6 kB)
  Downloading cupy_cuda12x-12.1.0-cp310-cp310-manylinux2014_x86_64.whl.metadata (2.6 kB)
  Downloading cupy_cuda12x-12.0.0-cp310-cp310-manylinux2014_x86_64.whl.metadata (2.6 kB)
Collecting geopandas>=0.11.0 (from cuspatial-cu12==24.10.0a43->cuspatial-cu12==24.10.0a43)
  Downloading geopandas-1.0.0-py3-none-any.whl.metadata (2.2 kB)
INFO: pip is still looking at multiple versions of cupy-cuda12x to determine which version is compatible with other requirements. This could take a while.
...
ERROR: Cannot install cudf-cu12, cuspatial-cu12 and cuspatial-cu12[test]==24.10.0a43 because these package versions have conflicting dependencies.

(build link)

Seems like it isn't even considering cupy-cuda12x>=13.2.0.

Just pushed c1f5845 bumping to cupy>=13.2.0.... let's see if it helps us get more information from the resolvers.

@jameslamb jameslamb added the 2 - In Progress Currenty a work in progress label Aug 30, 2024
@seberg
Copy link
Author

seberg commented Sep 5, 2024

Is the reason that something is pinning llvmlite to:
Collecting llvmlite<0.43,>=0.42.0dev0 at https://github.com/rapidsai/cuspatial/actions/runs/10635279113/job/29485001500?pr=1441#step:8:833 ?
But it isn't clear to me what is doing that.

@seberg
Copy link
Author

seberg commented Sep 14, 2024

Tried removing all new things and rebasing once more... I am confuse because it seems like there is something that just doesn't resolve in conda, but I am not sure what.

@bdice
Copy link
Contributor

bdice commented Sep 14, 2024

@seberg This is blocked because we're pinning to an old proj. See

- proj >=9.3.0,<9.3.1.0a0 # TODO: proj is being held back due to needing spdlog/fmt upgrades to support recent conda-forge builds of tiledb

This will be unblocked once we migrate to a newer fmt/spdlog. See rapidsai/build-planning#56. cc: @jameslamb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - In Progress Currenty a work in progress conda Related to conda and conda configuration improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Related to Python code
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants