Skip to content

Numpy 2.0 support #535

@nikhilpodila

Description

@nikhilpodila

Similar to this error previously in opencv, I get the following error when importing cv-bridge:

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "/opt/ros/humble/lib/my_driver/my_driver_node", line 33, in <module>
    sys.exit(load_entry_point('my-driver==0.1.0', 'console_scripts', 'my_driver_node')())
  File "/opt/ros/humble/lib/my_driver/my_driver_node", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/ros/humble/lib/python3.10/site-packages/my_driver/my_driver_node.py", line 8, in <module>
    from cv_bridge import CvBridge
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/cv_bridge/__init__.py", line 6, in <module>
    from cv_bridge.boost.cv_bridge_boost import cvtColorForDisplay, getCvType
AttributeError: _ARRAY_API not found

It looks like cv-bridge installed via apt or pip is not yet built with numpy 2.0. Is the support for numpy 2.0 coming soon?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions