Skip to content
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

AttributeError: module 'numpy' has no attribute 'float' #37

Open
zkytony opened this issue Feb 22, 2023 · 11 comments
Open

AttributeError: module 'numpy' has no attribute 'float' #37

zkytony opened this issue Feb 22, 2023 · 11 comments

Comments

@zkytony
Copy link

zkytony commented Feb 22, 2023

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
Copy link

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
Copy link

I have the same problem, both packages were installed through the ubuntu repositories

@sangshuduo
Copy link

I see this issue is fixed with #39. I wonder when it will be published to the pypi?

@lauralindzey
Copy link

@eric-wieser -- any chance of getting one last release to the ROS debs pushing the fix to this? (#39)

@eric-wieser
Copy link
Owner

I have no time for ROS anymore; in the past I added @gstavrinos as a maintainer to keep this project alive. Perhaps @gstavrinos has the time and/or motivation to do such a release?

@gstavrinos
Copy link
Collaborator

gstavrinos commented Nov 12, 2024

Hey, I am currently overloaded with stuff, but I promise to get to it asap!

@gstavrinos
Copy link
Collaborator

Eric, please give me the appropriate repository rights in order to add a secret (for a github action that releases the package)

@eric-wieser
Copy link
Owner

It's not clear to me that I can do that without moving this to an organization repo. Can you either point me to instructions on how to generate the secret so I can generate add it myself, or email it to me at $last.$first @ gmail.com so that I can add the one you generated?

@gstavrinos
Copy link
Collaborator

gstavrinos commented Nov 17, 2024

  1. Click your profile picture -> Settings -> Developer Settings -> Personal Access Tokens -> Tokens (classic) -> Generate new token -> Generate new token (classic) ->

    Expiration 30/08/2025
    (~3 months after the Noetic EOL, just to be sure we get the last sync, if needed)

    Select scopes:
    [x] workflow
    (it should also automatically check the whole repo scope)

    -> Generate token

  2. Copy the generated token

  3. Go to the ros_numpy repo -> Settings -> Secrets and variables -> Actions -> New repository secret ->

    Name
    BLOOM_GITHUB_TOKEN
    (important to be exactly like this, since I won't be able to check)

    Secret
    Paste the previously generated token

That's all! If you need any more help, hit me up!

@eric-wieser
Copy link
Owner

Thanks @gstavrinos! I'm not comfortable making a classic-style personal access token, as this grants permission to all of my repositories on github.

Are the fine-grained tokens an option? Can you share the script that will consume this token?

@gstavrinos
Copy link
Collaborator

Hey, Eric. That's a totally valid concern. This is why I asked you to directly make it a secret, so that no one (not even you!) has access to it afterwards. I think a fine-grained token with access to this repo and its release one, would also suffice though. (I haven't tested it)

The action I am going to use is similar to the one I use here:
https://github.com/gstavrinos/odom_to_tf_ros2/blob/master/.github/workflows/bloom-release.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants