vedo icon indicating copy to clipboard operation
vedo copied to clipboard

test extract_cells_by_type() failing on 32-bit arches: Expecting a numpy.int32 array, got int64 instead.

Open drew-parsons opened this issue 1 year ago • 2 comments

vedo 2024.5.2 tests are failing on 32-bit architectures in debian tests. The failure is in extract_cells_by_type() from common tests test_core2.py

517s --- TEST METHOD extract_cells_by_type() -------------------
517s           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
517s   File "/usr/lib/python3/dist-packages/vedo/grids.py", line 634, in extract_cells_by_type
517s     uarrtyp = utils.numpy2vtk(ctarrtyp, deep=False, dtype="id")
517s               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
517s   File "/usr/lib/python3/dist-packages/vedo/utils.py", line 778, in numpy2vtk
517s     varr = numpy_to_vtkIdTypeArray(arr.astype(np.int64), deep=deep)
517s            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
517s   File "/usr/lib/python3/dist-packages/vtkmodules/util/numpy_support.py", line 191, in numpy_to_vtkIdTypeArray
517s     raise ValueError(
517s ValueError: Expecting a numpy.int32 array, got int64 instead.

numpy2vtk in vedo/utils.py explicitly requests np.int64, which I presume is causing the error. Should it use simple python int instead?

Full test logs are available at armel https://ci.debian.net/packages/v/vedo/testing/armel/48706152/ armhf https://ci.debian.net/packages/v/vedo/testing/armhf/48706220/ i386 https://ci.debian.net/packages/v/vedo/testing/i386/48705992/ https://ci.debian.net/packages/v/vedo/

This is with vtk 9.3.0 and numpy 1.26.4.

drew-parsons avatar Jul 07 '24 11:07 drew-parsons

Thanks for reporting! I just committed a fix, but I guess that the simple python int should also do the trick...

marcomusy avatar Jul 11 '24 12:07 marcomusy

Great, I'll apply your patch to keep the codebase consistent.

drew-parsons avatar Jul 11 '24 14:07 drew-parsons