eigenpy icon indicating copy to clipboard operation
eigenpy copied to clipboard

py-user-type unittest failing on Raspbery Pi

Open nim65s opened this issue 2 years ago • 5 comments

Hi,

Raspbian buster 32bits, on a Raspberry Pi 4, raise the following issue with python3-numpy (python 3.7.3, numpy 1.16.2):

13/21 Test #13: py-user-type .....................***Failed    0.39 sec

code: 256
code: 257
Traceback (most recent call last):
  File "/home/pi/src/eigenpy-2.6.6/unittest/python/test_user_type.py", line 49, in <module>
    test(user_type.CustomDouble)
  File "/home/pi/src/eigenpy-2.6.6/unittest/python/test_user_type.py", line 9, in test
    mat = np.ones((rows,cols),dtype=dtype)
  File "/usr/lib/python3/dist-packages/numpy/core/numeric.py", line 224, in ones
    multiarray.copyto(a, 1, casting='unsafe')
ValueError: No cast function available.

Upgrading numpy with pip to 1.21.2 (this require to install the libatlas-base-dev apt package) fails with the following one:

Start 13: py-user-type
13/21 Test #13: py-user-type .....................***Failed    0.48 sec

code: 256
code: 257
Traceback (most recent call last):
  File "/home/pi/src/eigenpy-2.6.6/unittest/python/test_user_type.py", line 49, in <module>
    test(user_type.CustomDouble)
  File "/home/pi/src/eigenpy-2.6.6/unittest/python/test_user_type.py", line 9, in test
    mat = np.ones((rows,cols),dtype=dtype)
  File "/home/pi/.local/lib/python3.7/site-packages/numpy/core/numeric.py", line 205, in ones
    multiarray.copyto(a, 1, casting='unsafe')
  File "<__array_function__ internals>", line 6, in copyto
TypeError: Cannot cast data from int32 to CustomDouble.

Eigen version: 3.3.4 Boost version: 1.65.1

Our goal is to embed all computations in a RPi on an ODRI robot, and I don't think we'll need user-types, so those failures are not really an issue for us.

nim65s avatar Aug 19 '21 13:08 nim65s

The first trouble is expected. The second one is not really expected as we register the conversion types. Could you give me the type of 1 in "/home/pi/.local/lib/python3.7/site-packages/numpy/core/numeric.py", line 205?

jcarpent avatar Aug 19 '21 13:08 jcarpent

But indeed, the user_type is mostly for making pinocchio compatible with CppAD types in Python.

jcarpent avatar Aug 19 '21 13:08 jcarpent

Is it possible for you to update the boost version as well?

proyan avatar Aug 19 '21 16:08 proyan

@jcarpent : if I add print(type(1)) before the failing line, I get <class 'int'>. @proyan : sure, but I'll finish to compile what we need first ^^"

nim65s avatar Aug 19 '21 20:08 nim65s

@nim65s Could you give me access to the environment to quickly fix the issue?

jcarpent avatar Aug 21 '21 09:08 jcarpent

This issue is certainly due to a very old version of numpy. 1.13.3, 1.14.0 already failed. I will try to identify the source.

jcarpent avatar Jan 27 '23 10:01 jcarpent

Numpy 1.16.0 fixes the issue. #341 solves the bug. The conclusion is that user-type registration should not be used on Numpy < 1.16.0

jcarpent avatar Jan 27 '23 14:01 jcarpent