[3.5.23] test failures: TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
See original GitHub issueWhile updating the Fedora package, I see quite a few tests failing with this error:
TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
The failed “scratch build” is here: https://koji.fedoraproject.org/koji/taskinfo?taskID=40470914 Since the build will be trashed in a few days, I’ve attached the complete build logs here:
trimesh-3.5.14-build-fail.txt trimesh-3.5.14-build-fail-state.txt trimesh-3.5.14-build-fail-hw.txt
It seems to be arch specific. If I force the build to run on an x86_64 builder, I only get two failed tests:
=================================== FAILURES ===================================
____________________________ ExportTest.test_layer _____________________________
self = <tests.test_svg.ExportTest testMethod=test_layer>
def test_layer(self):
from shapely.geometry import Point
# create two disjoint circles and apply layers
a = g.trimesh.load_path(Point([0, 0]).buffer(1))
a.apply_layer('ACIRCLE')
b = g.trimesh.load_path(Point([2, 0]).buffer(1))
b.apply_layer('BCIRCLE')
# combine two circles
c = a + b
# should be combined
assert g.np.isclose(c.area, a.area + b.area)
# export C with just layer of A
aX = g.trimesh.load(g.io_wrap(
c.export(file_type='svg',
layers=['ACIRCLE'])),
file_type='svg')
# export C with all layers
cX = g.trimesh.load(g.io_wrap(
c.export(file_type='svg',
layers=None)),
file_type='svg')
> assert len(cX.entities) == len(c.entities)
E AssertionError: assert 1 == 2
E -1
E +2
../tests/test_svg.py:59: AssertionError
_____________________________ ExportTest.test_svg ______________________________
self = <tests.test_svg.ExportTest testMethod=test_svg>
def test_svg(self):
for d in g.get_2D():
# export as svg string
exported = d.export(file_type='svg')
# load the exported SVG
stream = g.trimesh.util.wrap_as_stream(exported)
if g.np.isclose(d.area, 0.0):
continue
loaded = g.trimesh.load(stream, file_type='svg')
# we only have line and arc primitives as SVG
# export and import
if all(i.__class__.__name__ in ['Line', 'Arc']
for i in d.entities):
# perimeter should stay the same-ish
# on export/import
> assert g.np.isclose(d.length,
loaded.length,
rtol=.01)
E AssertionError: assert False
E + where False = <function isclose at 0x7f5cb37e0f70>(15.16883270309641, 10.88659282532712, rtol=0.01)
E + where <function isclose at 0x7f5cb37e0f70> = <module 'numpy' from '/usr/lib64/python3.8/site-packages/numpy/__init__.py'>.isclose
E + where <module 'numpy' from '/usr/lib64/python3.8/site-packages/numpy/__init__.py'> = g.np
E + and 15.16883270309641 = <trimesh.Path2D(vertices.shape=(4, 2), len(entities)=4)>.length
E + and 10.88659282532712 = <trimesh.Path2D(vertices.shape=(4, 2), len(entities)=1)>.length
../tests/test_svg.py:27: AssertionError
=============================== warnings summary ===============================
/usr/lib/python3.8/site-packages/svg/path/path.py:3
/usr/lib/python3.8/site-packages/svg/path/path.py:3: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
from collections import MutableSequence
tests/test_normals.py::NormalsTest::test_weighted_vertex_normals
/builddir/build/BUILD/trimesh-3.5.14/trimesh/triangles.py:109: RuntimeWarning: invalid value encountered in true_divide
u /= util.row_norm(u).reshape((-1, 1))
tests/test_triangles.py::TrianglesTest::test_zero_angle
/builddir/build/BUILD/trimesh-3.5.14/trimesh/triangles.py:111: RuntimeWarning: invalid value encountered in true_divide
w /= util.row_norm(w).reshape((-1, 1))
-- Docs: https://docs.pytest.org/en/latest/warnings.html
====== 2 failed, 324 passed, 12 deselected, 3 warnings in 219.35 seconds =======
The logs from this build are here: https://koji.fedoraproject.org/koji/taskinfo?taskID=40471476
trimesh-3.5.14-build-fail-2.txt trimesh-3.5.14-build-fail-hw-2.txt trimesh-3.5.14-build-fail-state-2.txt
Cheers,
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Cannot cast array data from dtype('float64') to dtype('int32 ...
Your original result array contains elements of type 'numpy.int64', but the result/4 operation returns an array of elements of type 'numpy.
Read more >Change data type of given numpy array - GeeksforGeeks
Problem #1 : Given a numpy array whose underlying data is of 'int32' type. Change the dtype of the given object to 'float64'...
Read more >cannot convert 0.0 to eagertensor of dtype int64 - You.com
Describe the expected behavior Variable should be converted to EagerTensor, operation should return constrained variable. Code to reproduce the issue Provide a ...
Read more >numpy.can_cast — NumPy v1.24 Manual
Data type, scalar, or array to cast from. todtype or dtype specifier. Data type to cast to. casting{'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional....
Read more >NumPy User Guide
differences between NumPy arrays and the standard Python sequences: ... TypeError: Cannot cast ufunc add output from dtype('float64') to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
All of the failures are still due to:
The list of failing tests is:
A new failure has appeared in 3.17.0, similar to the existing 32-bit failures: