CyLP icon indicating copy to clipboard operation
CyLP copied to clipboard

Add support for numpy 2

Open mkoeppe opened this issue 1 year ago • 1 comments

  [cylp-0.92.3]   [spkg-install] [1/1] Cythonizing cylp/cy/CyCoinIndexedVector.pyx
  [cylp-0.92.3]   [spkg-install] building 'cylp.cy.CyCoinIndexedVector' extension
  [cylp-0.92.3]   [spkg-install] g++ -std=gnu++11 -g -O2 -fPIC -I/sage/local/include/coin -I./cylp/cpp -I./cylp/cy -I/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/numpy/_core/include -I. -I/sage/local/var/lib/sage/venv-python3.12/include -I/usr/include/python3.12 -c cylp/cpp/ICoinIndexedVector.cpp -o build/temp.linux-x86_64-cpython-312/cylp/cpp/ICoinIndexedVector.o -w -std=c++11
  [cylp-0.92.3]   [spkg-install] cylp/cpp/ICoinIndexedVector.cpp: In member function 'void ICoinIndexedVector::assign(PyObject*, PyObject*)':
  [cylp-0.92.3]   [spkg-install] cylp/cpp/ICoinIndexedVector.cpp:124:49: error: cannot convert 'PyObject*' {aka '_object*'} to 'const PyArrayObject*' {aka 'const tagPyArrayObject_fields*'}
  [cylp-0.92.3]   [spkg-install]   124 |             npy_intp other_length = PyArray_DIM(other, 0);
  [cylp-0.92.3]   [spkg-install]       |                                                 ^~~~~
  [cylp-0.92.3]   [spkg-install]       |                                                 |
  [cylp-0.92.3]   [spkg-install]       |                                                 PyObject* {aka _object*}

https://github.com/passagemath/passagemath/actions/runs/12271500236/job/34367568988#step:11:2755

mkoeppe avatar Dec 13 '24 20:12 mkoeppe

It will probably be some time before I can look into this myself, but it would be great to have!

tkralphs avatar Dec 27 '24 02:12 tkralphs

Arch Linux has a patch for it https://gitlab.archlinux.org/archlinux/packaging/packages/python-cylp/-/blob/c5193b53377de28811180e752a8d8d2cf0aaf1d3/numpy-2.0.patch

a-andre avatar Jun 23 '25 16:06 a-andre

Thanks, @a-andre, I just pulled the patch and opened #212, but I think there may be a few other details to be taken care of if anyone can have a look.

tkralphs avatar Jun 25 '25 02:06 tkralphs

#212 is now merged so we have numpy 2 support! I'll create a new release shortly.

tkralphs avatar Jun 25 '25 20:06 tkralphs