source icon indicating copy to clipboard operation
source copied to clipboard

Limit numpy version to < 2 in install_requires and make another post release

Open vsnever opened this issue 1 year ago • 2 comments

Raysect's build requirements specify oldest-supported-numpy, which is 1.14, while install_requires sets the NumPy version to numpy>=1.14, which installs NumPy 2.0 in Python 3.9 and above. Since NumPy 2.0 and 1.x are not binary compatible, trying to run any Raysect code produces errors like this:

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

I propose to constrain the NumPy version to 1.x in setup.py and make another post release.

vsnever avatar Aug 04 '24 15:08 vsnever

Building with Numpy 2.0 provides backwards compatibility with runtime 1.x. So I think it'd actually be better to update pyproject.toml to use numpy~=2.0 for Python 3.9 and later, and oldest-supported-numpy for Python 3.8 and earlier. That would additionally mean packages depending on Raysect wouldn't have to pin to Numpy 1.x either on newer Pythons.

I don't know whether it's worth also updating install_requires, since building with Numpy 1.x on 3.8 and earlier wouldn't be an issue as Numpy 2.0 isn't available at runtime on 3.8 and earlier (without a user trying rather hard to get it installed, at which point they should expect problems!).

jacklovell avatar Oct 28 '24 18:10 jacklovell

Raysect 0.9 has updated the install requirements to python 3.9+, cython 3.1+ and numpy 2+.

CnlPepper avatar Jul 20 '25 20:07 CnlPepper