-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add support for float numpy>=1.24 #597
Conversation
jaku-jaku
commented
Feb 7, 2023
•
edited
Loading
edited
- numpy float deprecated
Can one of the admins verify this patch? |
Does this have backwards compatibility? What version of OS / libs are you using? |
OS: Ubuntu 20.04 | ROS Noetic | Python 3.8.10 | numpy: 1.24.1 import numpy as np
np.float Output:
As stated in numpy 1.20 - deprecations, it will be no longer supported due to duplication. |
@goldbattle are there plans to merge this PR? |
I have not had time to reproduce in a docker container and ensure it has backwards compatibility. Need to also verify that this is the only place that needs it, and likely create a ubuntu 22 docker. |
Try to check your numpy version in your docker. |
As refer from https://stackoverflow.com/questions/74844262/how-can-i-solve-error-module-numpy-has-no-attribute-float-in-python
I will make a test locally and update this PR with backward support
pip3 install numpy==1.24 now run calibration: File "{my-path}/kalibr/aslam_offline_calibration/kalibr/python/kalibr_camera_calibration/CameraUtils.py", line 123, in getReprojectionErrorStatistics
mean = np.mean(rerr_matrix, 0, dtype=np.float)
File "{my-home}/.local/lib/python3.8/site-packages/numpy/__init__.py", line 284, in __getattr__
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'float'
|
+ but np.float64 has been supported still
Fixes tested: Python 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.float
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jx/.local/lib/python3.8/site-packages/numpy/__init__.py", line 284, in __getattr__
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'float'
>>> numpy.float64
<class 'numpy.float64'>
>>> numpy.version.version
'1.24.0' and backward Python 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.float
<class 'float'>
>>> numpy.float64
<class 'numpy.float64'>
>>> numpy.version.version
'1.17.4' |
@adthoms @goldbattle Done, and tested for backward and forward compatible. You can replicate the above issue on the main branch by |
Many thanks for the detailed PR and steps to test, was able to reproduce and this PR fixed the issues. Many thanks. |