Skip to content

Backwards incompatible change in C API with Numpy 1.20 #8

@jpgill86

Description

@jpgill86

As is explained here, Numpy 1.20 introduced a change to its C API. This affects Python packages with compiled components that depend on Numpy, such as axographio. The version of Numpy installed at compile time can limit the versions of Numpy compatible with the package at run time. That is:

  • The API changes are not backwards-compatible: If axographio is built with Numpy 1.20, the wheel will not be compatible with installations running older versions of Numpy.
  • Numpy 1.20 is still compatible with older wheels: If axographio is built with Numpy 1.19, the wheel will still be compatible with installations running newer versions of Numpy.

Unaware of any of this, today I published a new wheel for Python 3.9 to PyPI (axographio-0.3.1-cp39-cp39-win_amd64.whl). I had Numpy 1.20 installed when building. The wheel is incompatible with Python 3.9 installations running Numpy 1.19, resulting in this error when trying to read a file:

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

Because setup.py does not indicate a run-time requirement of Numpy 1.20, anyone installing axographio into an environment with Python 3.9 and Numpy 1.19 or older will get a broken version of axographio.

I don't have the privileges on PyPI needed to replace or delete the bad wheel. To work around this, I plan to release a new version of axographio built with Numpy 1.19, which should be compatible with Numpy 1.20 too. The only change will be a version number bump.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions