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 compatibility issue #742

Open
mauzey1 opened this issue May 20, 2024 · 2 comments
Open

Numpy 2.0 compatibility issue #742

mauzey1 opened this issue May 20, 2024 · 2 comments
Milestone

Comments

@mauzey1
Copy link
Collaborator

mauzey1 commented May 20, 2024

A recent conda-forge build for CMOR that updates NumPy to 2.0 encountered the following error.

Processing $SRC_DIR
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/Users/runner/miniforge3/conda-bld/cmor_1716145369063/work/setup.py", line 6, in <module>
          include_dirs = [numpy.lib.utils.get_include(),"include","include/cdTime"]
        File "/Users/runner/miniforge3/conda-bld/cmor_1716145369063/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.10/site-packages/numpy/lib/__init__.py", line 77, in __getattr__
          raise AttributeError(
      AttributeError: numpy.lib.utils is now private. If you are using a public function, it should be available in the main numpy namespace, otherwise check the NumPy 2.0 migration guide.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

I think this should be resolved by replacing numpy.lib.utils.get_include() with numpy.get_include() in setup.py.in.

include_dirs = [numpy.lib.utils.get_include(),"include","include/cdTime"]

@mauzey1 mauzey1 added this to the 3.9.0 milestone May 20, 2024
@durack1
Copy link
Contributor

durack1 commented May 20, 2024

@mauzey1 this might be worth watching as the current rc2 release (as of today) becomes the final version. I am curious if this has anything to do with the very old unsupported cdat/cdtime library, or with the evolving C-API changes (here, also see https://numpy.org/devdocs/numpy_2_0_migration_guide.html)

@durack1
Copy link
Contributor

durack1 commented Jun 3, 2024

16 June 2024 is now the official release date for numpy 2.0 (see here), so we should make sure CMOR 3.9.0 works with this new library!

As the release date is now set, pushing the CMOR 3.9.0 milestone delivery out a week to enable testing is a good idea indeed - 28th June 2024

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

No branches or pull requests

2 participants