-
Notifications
You must be signed in to change notification settings - Fork 598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NumPy 2.0 compatibility #2216
Comments
Thanks for the list!! I have been running the ruff Seems like a lot of the other ones are "shapely didn't import" maybe it needs a prerelease or something, I'll take a look. |
Oh, sorry, that's probably on my end. Lemme rebuild shapely and see if that helps. |
Yeah, it was my fault. I've fixed the Gentoo Shapely package and updated the list. Thanks! |
Do you want me to try making a pull request, at least for the problems with "obvious" solutions? |
Yeah a PR would be awesome! I got distracted trying to write a ruff rule in addition to NPY201 for the ndarray.ptp removal but since it's not a simple replacement it does not look easy to do automatically like that. I wonder why they nuked ptp, and why the deprecation messages didn't show up in pytest. |
I got the
|
Thanks. With the linked PR applied on top of 4.3.2, I'm down to: FAILED tests/test_transformations.py::TransformTest::test_doctest - ValueError: TestResults(failed=7, attempted=389)
FAILED tests/test_transformations.py::TransformTest::test_symbolic_euler - ValueError: could not convert string to float: 'np.float64(0.417022004702574)'
FAILED tests/test_transformations.py::TransformTest::test_symbolic_translate - ValueError: could not convert string to float: 'np.float64(0.417022004702574)'
FAILED tests/test_voxel.py::VoxelGridTest::test_roundtrip - AssertionError: assert False
+ where False = <function allclose at 0x7f4bdf7353b0>(array([[-0.55, -0.55, -0.55],\n [-0.25, 0.55, 0.55]]), array([[-0.55, -0.55, -0.55],\n [ 0.55, 0.55, 0.55]]))
+ where <function allclose at 0x7f4bdf7353b0> = <module 'numpy' from '/usr/lib/python3.11/site-packages/numpy/__init__.py'>.allclose
+ where <module 'numpy' from '/usr/lib/python3.11/site-packages/numpy/__init__.py'> = g.np
+ and array([[-0.55, -0.55, -0.55],\n [-0.25, 0.55, 0.55]]) = <trimesh.VoxelGrid(11, 11, 11)>.bounds
+ and array([[-0.55, -0.55, -0.55],\n [ 0.55, 0.55, 0.55]]) = <trimesh.VoxelGrid(np.int64(11), np.int64(11), np.int64(11))>.bounds
FAILED tests/test_section.py::SliceTest::test_cap - assert False
+ where False = <trimesh.Trimesh(vertices.shape=(6, 3), faces.shape=(8, 3))>.is_watertight
FAILED tests/test_section.py::SliceTest::test_cap_coplanar - assert False
+ where False = <trimesh.Trimesh(vertices.shape=(3505, 3), faces.shape=(7014, 3))>.is_watertight
FAILED tests/test_section.py::SliceTest::test_slice_onplane - assert False
+ where False = <trimesh.Trimesh(vertices.shape=(1550, 3), faces.shape=(3132, 3))>.is_watertight
FAILED tests/test_creation.py::CreationTest::test_path_sweep - ValueError: zero-size array to reduction operation maximum which has no identity
FAILED tests/test_creation.py::CreationTest::test_triangulate - AssertionError: assert np.False_
+ where np.False_ = <function isclose at 0x7f4bdf735530>(np.float64(0.0), 3.1365484905459398)
+ where <function isclose at 0x7f4bdf735530> = <module 'numpy' from '/usr/lib/python3.11/site-packages/numpy/__init__.py'>.isclose
+ where <module 'numpy' from '/usr/lib/python3.11/site-packages/numpy/__init__.py'> = g.np
FAILED tests/test_creation.py::CreationTest::test_triangulate_plumbing - AssertionError: assert np.False_
+ where np.False_ = <function isclose at 0x7f4bdf735530>(np.float64(0.0), 30768.414982316746)
+ where <function isclose at 0x7f4bdf735530> = <module 'numpy' from '/usr/lib/python3.11/site-packages/numpy/__init__.py'>.isclose
+ where <module 'numpy' from '/usr/lib/python3.11/site-packages/numpy/__init__.py'> = g.np |
Nice! I think some/most of these are fixed by installing the |
I'm afraid upgrading to sympy 1.12.1rc1 doesn't improve things (though sympy itself stops failing tests). |
Yeah actually same re: sympy it was just my development machine had silently downgraded numpy. At least a few of these are mapbox_earcut. It's a pybind thing using numpy which is probably gonna need a PR unfortunately haha:
|
If you install mapbox-earcut from source |
Thanks! That gets me down to two failures: FAILED tests/test_transformations.py::TransformTest::test_doctest - ValueError: TestResults(failed=7, attempted=389)
FAILED tests/test_voxel.py::VoxelGridTest::test_roundtrip - AssertionError: assert False
+ where False = <function allclose at 0x7f5ccf730b70>(array([[-0.55, -0.55, -0.55],\n [-0.25, 0.55, 0.55]]), array([[-0.55, -0.55, -0.55],\n [ 0.55, 0.55, 0.55]]))
+ where <function allclose at 0x7f5ccf730b70> = <module 'numpy' from '/usr/lib/python3.11/site-packages/numpy/__init__.py'>.allclose
+ where <module 'numpy' from '/usr/lib/python3.11/site-packages/numpy/__init__.py'> = g.np
+ and array([[-0.55, -0.55, -0.55],\n [-0.25, 0.55, 0.55]]) = <trimesh.VoxelGrid(11, 11, 11)>.bounds
+ and array([[-0.55, -0.55, -0.55],\n [ 0.55, 0.55, 0.55]]) = <trimesh.VoxelGrid(np.int64(11), np.int64(11), np.int64(11))>.bounds The first one seems to be the doctest case, the second one I don't know. |
I think I got those last 2, and am putting together a PR for mapbox-earcut. |
Thanks. It seems that the tests pass for me on |
When running trimesh's 4.3.2 test suite against NumPy 2.0.0rc1, I'm getting lots of test failures.
The vast majority of them are akin to:
The remaining (non-ptp) failures are:
The log with tracebacks has over 50M, so I can't really attach it. However, I suppose you will be able to reproduce most of it, and I can re-report when the most common issues are resolved.
The text was updated successfully, but these errors were encountered: