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

Built Chaco may be binary-incompatible with older NumPy versions #778

Closed
mdickinson opened this issue Jun 11, 2021 · 4 comments · Fixed by #779
Closed

Built Chaco may be binary-incompatible with older NumPy versions #778

mdickinson opened this issue Jun 11, 2021 · 4 comments · Fixed by #779

Comments

@mdickinson
Copy link
Member

mdickinson commented Jun 11, 2021

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

@mdickinson
Copy link
Member Author

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?

@mdickinson mdickinson changed the title Pin NumPy version in build dependencies Built Chaco may be binary-incompatible with older NumPy versions Jun 11, 2021
@mdickinson
Copy link
Member Author

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.

@aaronayres35
Copy link
Contributor

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.

@mdickinson
Copy link
Member Author

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

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

Successfully merging a pull request may close this issue.

2 participants