Skip to content

Numpy 2.0 incompatibility #318

@djhoese

Description

@djhoese

To report a non-security related issue, please provide:

  • the version of the software with which you are encountering an issue: current master branch
  • environmental information (i.e. Operating System, compiler info, java version, python version, etc.): Python 3.12 with numpy 2.0 nightly wheel
  • a description of the issue with the steps needed to reproduce it:

Numpy 2.0 will now require that you call the C API level np.import_array() before using the C API in Cython extensions. Importing cftime with numpy 2.0 gives you:

../../../miniconda3/envs/test-environment/lib/python3.12/site-packages/cftime/__init__.py:1: in <module>
    from ._cftime import (datetime, real_datetime,
src/cftime/_cftime.pyx:1: in init cftime._cftime
    ???
E   ImportError: numpy.core.multiarray failed to import (auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; use '<void>numpy._import_array' to disable if you are certain you don't need it).

Note: Numpy 2.0 isn't out yet...but it will be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions