ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ModuleNotFoundError: No module named 'rclpy._rclpy_pybind11'

asked 2022-09-27 20:30:47 -0500

ever gravatar image

updated 2022-09-28 02:58:41 -0500

ravijoshi gravatar image

Hello everyone,

I am new to ros and just built this ros on macOS and tried the ros demo.

The cpp talker works well but when I tried to run the demon

ros2 run demo_nodes_py listener

The error are shown as

Traceback (most recent call last):
  File "/Users/weizhaoli/ROS/ros2_humble/install/demo_nodes_py/lib/demo_nodes_py/listener", line 33, in <module>
    sys.exit(load_entry_point('demo-nodes-py', 'console_scripts', 'listener')())
  File "/Users/weizhaoli/ROS/ros2_humble/install/demo_nodes_py/lib/demo_nodes_py/listener", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/local/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/local/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/weizhaoli/ROS/ros2_humble/build/demo_nodes_py/demo_nodes_py/topics/listener.py", line 17, in <module>
    import rclpy
  File "/Users/weizhaoli/ROS/ros2_humble/install/rclpy/lib/python3.7/site-packages/rclpy/__init__.py", line 49, in <module>
    from rclpy.signals import install_signal_handlers
  File "/Users/weizhaoli/ROS/ros2_humble/install/rclpy/lib/python3.7/site-packages/rclpy/signals.py", line 15, in <module>
    from rclpy.exceptions import InvalidHandle
  File "/Users/weizhaoli/ROS/ros2_humble/install/rclpy/lib/python3.7/site-packages/rclpy/exceptions.py", line 15, in <module>
    from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
  File "/Users/weizhaoli/ROS/ros2_humble/install/rclpy/lib/python3.7/site-packages/rclpy/impl/implementation_singleton.py", line 32, in <module>
    rclpy_implementation = import_c_library('._rclpy_pybind11', package)
  File "/Users/weizhaoli/ROS/ros2_humble/build/rpyutils/rpyutils/import_c_library.py", line 39, in import_c_library
    return importlib.import_module(name, package=package)
  File "/usr/local/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'rclpy._rclpy_pybind11'
The C extension '/Users/weizhaoli/ROS/ros2_humble/build/rpyutils/_rclpy_pybind11.cpython-310-darwin.so' isn't present on the system. Please refer to 'https://docs.ros.org/en/humble/Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system' for possible solutions
[ros2run]: Process exited with failure 1

I know there is a similar post but the answer does not fix my issue since I didn't have conda. And I am confused why there is python3.7 and I don't have python3.7 in my system.

Thank you!

edit retag flag offensive close merge delete

Comments

Clearly the ROS 2 installation is broken. Did you follow the steps mentioned in the documentation? If not, you should reinstall and try again, please. Furthermore, going through the link provided in the error logs may help.

ravijoshi gravatar image ravijoshi  ( 2022-09-28 02:57:02 -0500 )edit

I did follow the documentation step by step to finish this installation and don't know which step I got wrong.

ever gravatar image ever  ( 2022-09-28 09:09:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-09-28 08:24:20 -0500

ljaniec gravatar image

You can try to use docker to use ROS 2 on your Mac instead:

The first steps will be a bit harder because of new tool, but it will make everything easier later - there is a wonderful tutorial how to use ROS dockers with VS Code:

I think it is worth trying.

edit flag offensive delete link more

Comments

Thank you so much for the reply. I am not familiar with docker. But I will take a look at it.

ever gravatar image ever  ( 2022-09-28 09:09:57 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-09-27 20:30:47 -0500

Seen: 1,517 times

Last updated: Sep 28 '22