enthought/chaco

Built Chaco may be binary-incompatible with older NumPy versions

Closed this issue ยท 4 comments

PR #730 introduced a pyproject.toml that declares build dependencies - this means that a pip install chaco will automatically first install NumPy, instead of just failing because NumPy isn't present in the build environment.

But there's a subtle problem here: with the current pyproject.toml,

  • pip install chaco will build Chaco against the latest release of NumPy available from PyPI (regardless of any version of NumPy that happens to already be in the environment)
  • the extension modules generated this way will not necessarily be compatible with earlier versions of NumPy

The result is that the built Chaco may segfault if installed into an environment whose NumPy version is not the latest NumPy.

As a general rule, extension modules built against earlier versions of NumPy can reasonably be expected to be ABI-compatible with later versions of NumPy, but not the other way around.

A possible solution is to pin the NumPy version (just to the minor version, not the bugfix level) used for the build to the earliest NumPy version that we might want to support. This is the approach taken in ibm2ieee, for example.

See also previous discussion in #467.

xref: enthought/ibm2ieee#7, enthought/ibm2ieee#8, enthought/ibm2ieee#9, enthought/ibm2ieee#10
further reading: pypa/pip#6144, pypa/pip#4582, numpy/numpy#5888

We'll have the same issue with Enable. @rahulporuri or @aaronayres35: can I leave it to one of you to open an equivalent issue for that repository?

Ah, this looks really interesting: https://github.com/scipy/oldest-supported-numpy. It looks as though the fix may be as simple as replacing numpy with oldest-supported-numpy.

What I don't know is whether we'll have similar issues with Cython.

What I don't know is whether we'll have similar issues with Cython.

IIUC, Cython is not a runtime dependency though, so there shouldn't be any conflicts(?) My initial understanding of the issue is that we may build with numpy latest, but then use older numpy at runtime because that is what is available in the environment, and then the built extension modules may not be compatible. It is very possible I am missing something though / my understanding is incorrect.

Ah, good point; yes, I think we're probably fine with Cython then.