pyvista / fast-simplification

Fast Quadratic Mesh Simplification
https://pyvista.github.io/fast-simplification/
MIT License
108 stars 15 forks source link

Issues with Numpy>=2.0 #38

Closed Louis-Pujol closed 2 months ago

Louis-Pujol commented 3 months ago

Hi @akaszynski !

There is an issue for fast-simplification with Numpy2.0. An example in a recent PR: https://github.com/pyvista/fast-simplification/actions/runs/10048065221/job/27771195361?pr=37

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

So far oldest-supported-numpy is used for the build. To use fast-simplification with the precompiled wheel, I need to downgrade Numpy to 1.26. What do you think about changing oldest-supported-numpy to numpy>=2.0 in the build requirements ?

akaszynski commented 3 months ago

That's one way to fix it. The alternative is to move over to building with nanobind, which carries the advantage of working on numpy 1.X and 2.X, while also reducing the size of the compiled wheels and providing a minor performance boost.

See work in https://github.com/pyvista/stl-reader for how to use scikit-build-core and nanobind.

A bit busy this week, but I'll likely get to it by the end of the week.

Louis-Pujol commented 3 months ago

Seems to be a great alternative. I never used nanobind, I'll take some time this week to read what you have done for stl-reader

akaszynski commented 2 months ago

Too busy to move over to nanobind, just going with bumping the cython build to use numpy 2.

akaszynski commented 2 months ago

Resolved with fast-simplification==0.1.8.