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
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):
The text was updated successfully, but these errors were encountered:
davidghiurco
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
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?
Describe the bug
Currently the 0.8.1.0 release pyproject.toml has:
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 ofnumpy
. This can have the unintended consequence of making the resultingPOT
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 benumpy==1.20.0
, not whatever is the newest version at the time of compilation withnumpy>=1.20
inpyproject.toml
.Addressing this problem will prevent future bug reports when POT is inevitably built against
numpy>=1.22
, which has a backwards-breaking ABI change to 1.20.x & 1.21.x (see https://numpy.org/doc/stable/release/1.22.0-notes.html#compatibility-notes, and numpy/numpy#19479)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 againstnumpy>=1.22.x
(which was released December 31st, 2021).2. Attempt to use the compiled package on a platform running
numpy==1.20.x
ornumpy==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):
numpy 1.22.x
is affected).pip
,conda
): pip & source, but this problem affects future wheel POT builds.The text was updated successfully, but these errors were encountered: