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

baldor makes the package fails #133

Open
hassan-tht opened this issue Apr 14, 2023 · 3 comments
Open

baldor makes the package fails #133

hassan-tht opened this issue Apr 14, 2023 · 3 comments

Comments

@hassan-tht
Copy link

Hi

I got the following error when I try to do the hand-eye calibration:

[ERROR] [1681225883.511651768]: Failed to load python module: handeye.calibrator
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/handeye/__init__.py", line 2, in <module>
    from .calibrator import HandEyeCalibrator, Setup
  File "/opt/ros/noetic/lib/python3/dist-packages/handeye/calibrator.py", line 5, in <module>
    import baldor as br
  File "/opt/ros/noetic/lib/python3/dist-packages/baldor/__init__.py", line 13, in <module>
    _MAX_FLOAT = np.maximum_sctype(np.float)
  File "/home/tht/.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'

I'm using Noetic and my Numpy version is 1.24 which explains the error as np.float has been depreciated. A quick fix for me was to change the corresponding lines in opt/ros/noetic/lib/python3/dist-packages/baldor/__init__.py that have the np.float to just float

@bmegli
Copy link

bmegli commented Apr 24, 2023

Looks like it was fixed in baldor code

Looking at commits package with the fixes has not been released yet

Other ad-hoc fix options are probably:

  • build baldor from source
  • downgrade numpy to pre 1.24
  • and one mentioned by @hassan-tht above

@bmegli
Copy link

bmegli commented Apr 25, 2023

@hassan-tht

The likely reason why this happens is you have pip installed numpy at version >= 1.24

ROS depends on system package version which is overridden by pip version

To check pip version

pip show numpy

To check system version

apt-cache policy python3-numpy

I am experiencing similar problems on some of my development machines
(likely pip installed packages that pulled numpy as dependency)

On production machines that have clean focal + noetic I don't face those problems.


One way to workaround is downgrading numpy to latest pre 1.24 version

# check installed version
pip show numpy

If numpy >= 1.24 downgrade to latest pre 1.24

# install at 1.23.5
pip install --force-reinstall numpy==1.23.5

@hassan-tht
Copy link
Author

Thanks for the note regarding development/production machines. Downgrading is of course a valid option, but we have other related software stack that might complain if we downgrade

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

2 participants