kbarbary / sep

Python and C library for source extraction and photometry
183 stars 57 forks source link

sep incompatible with numpy 2.0.0 and Cython 3.0 #157

Open StuartLittlefair opened 3 months ago

StuartLittlefair commented 3 months ago

We are trying to update our python packages for Numpy 2.0.0 compatibility and have sep as a dependency.

When trying to use sep with numpy 2.0.0 we get the following error:

File sep.pyx:1, in init sep()

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

Assuming this was due to conflicts between the installed numpy version and the version sep was compiled against I built sep from scratch (this required changing references to np.int_t in sep.pyx to np.intp_t or np.int32_t - both give the same result).

After recompilation and installation, the error persists. I checked that I was compiling and linking against numpy 2.0.0.

StuartLittlefair commented 3 months ago

note that I was able - after carefully checking my environment - to get sep to work with numpy and Cython 3.0.

I needed to change all uses of np.int_t in sep.pyx with np.int32_t. I also had to install with python setup.py build_ext; python setup.py install.

PJ-Watson commented 2 months ago

@StuartLittlefair if it's at all helpful for you, I forked sep a while back to try and implement some of the outstanding bug fixes - the current version (v1.3.5, https://github.com/PJ-Watson/sep-pjw) should be a drop-replacement for sep, and is now compatible with Numpy 2.0.