Numpy 2.0 compatibility issue
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.
https://github.com/PCMDI/cmor/blob/7714266a456ecf6b5edf3b826d8e78919c0b9494/setup.py.in#L6
@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)
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