You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Change pyproject.toml to require the oldest possible numpy version to prevent future backwards-breaking numpy ABI changes #346
The problem with numpy>=1.20 is that for source installations, as well as wheel builds, this will actually use the latest (at build time) version of numpy. This can have the unintended consequence of making the resulting POT build compatible only with that latest numpy version (and newer).
This is because builds against numpy are forward compatible, but not backward compatible. (Source: numpy docs). What this means for POT is that it should be compiled against the oldestnumpy version that it supports. In our current case, this would be numpy==1.20.0, not whatever is the newest version at the time of compilation with numpy>=1.20 in pyproject.toml.
There is a meta-package developed by numpy devs called oldest-supported-numpy which is meant to be used exclusively in pyproject.toml for the purposes of building/compiling against numpy. Newer versions of numpy can still be used as runtime dependencies without breaking binary compatibility.
To Reproduce
Steps to reproduce the behavior:
1.build current codebase from latest release 0.8.1.0 from source, it will be built against numpy>=1.22.x (which was released December 31st, 2021).
2. Attempt to use the compiled package on a platform running numpy==1.20.x or numpy==1.21.x, you will get something similar to: ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
Expected behavior
POT should be built against the oldest numpy package it supports. This does not prevent using newer numpy versions as runtime dependencies.
Environment (please complete the following information):
OS (e.g. MacOS, Windows, Linux): MacOS Monterey, Version 12.1
Python version: 3.8+ (any python version that supports numpy 1.22.x is affected).
How was POT installed (source, pip, conda): pip & source, but this problem affects future wheel POT builds.
Build command you used (if compiling from source):
changed the title [-]Change pyproject.toml to require the oldest possible numpy version to prevent future backwards-breaking numpy ABI chan[/-][+]Change pyproject.toml to require the oldest possible numpy version to prevent future backwards-breaking numpy ABI changes[/+]on Feb 10, 2022
Hello @davidghiurco and thank you for the detailed explanation.
I'm OK with switching the pyproject.toml build dependency to oldest-supported-numpy instead of the current value since it will indeed provide since it will provide wheels that will work on most of the used version of numpy and it is the recommended strategy by numpy developers themselves.
Could you do a PR with this change and add build all wheels in the test of your commit to trigger wheels building and check that nothing breaks?
Activity
[-]Change pyproject.toml to require the oldest possible numpy version to prevent future backwards-breaking numpy ABI chan[/-][+]Change pyproject.toml to require the oldest possible numpy version to prevent future backwards-breaking numpy ABI changes[/+]rflamary commentedon Feb 11, 2022
Hello @davidghiurco and thank you for the detailed explanation.
I'm OK with switching the
pyproject.tomlbuild dependency tooldest-supported-numpyinstead of the current value since it will indeed provide since it will provide wheels that will work on most of the used version of numpy and it is the recommended strategy by numpy developers themselves.Could you do a PR with this change and add
build all wheelsin the test of your commit to trigger wheels building and check that nothing breaks?