AttributeError: module 'numpy' has no attribute 'float'
zkytony opened this issue ยท 3 comments
zkytony commented
I encounter the following Trackback when using ros_numpy
:
Traceback (most recent call last):
...
File "/home/kzheng/repo/robotdev/spot/ros_ws/src/genmos_object_search_ros/src/genmos_ros/ros_utils.py", line 13, in <module>
import ros_numpy
File "/opt/ros/noetic/lib/python3/dist-packages/ros_numpy/__init__.py", line 7, in <module>
import ros_numpy
File "/opt/ros/noetic/lib/python3/dist-packages/ros_numpy/__init__.py", line 7, in <module>
from . import point_cloud2
File "/opt/ros/noetic/lib/python3/dist-packages/ros_numpy/point_cloud2.py", line 224, in <module>
from . import point_cloud2
File "/opt/ros/noetic/lib/python3/dist-packages/ros_numpy/point_cloud2.py", line 224, in <module>
def get_xyz_points(cloud_array, remove_nans=True, dtype=np.float):
File "/home/kzheng/repo/robotdev/spot/venv/spot/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
def get_xyz_points(cloud_array, remove_nans=True, dtype=np.float):
File "/home/kzheng/repo/robotdev/spot/venv/spot/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
raise AttributeError(__former_attrs__[attr])
According to this Stackoverflow, np.float
causes an error with Numpy 1.24+. (I have 1.24.2 installed).
Is this package still being maintained to address this issue?
pabsan-0 commented
Hello! At your own risk, you can get around this by overwriting the np.float
reference.
import numpy as np
np.float = np.float64 # temp fix for following import
import ros_numpy
denseishin commented
I have the same problem, both packages were installed through the ubuntu repositories
sangshuduo commented
I see this issue is fixed with #39. I wonder when it will be published to the pypi?