ModuleNotFoundError: No module named 'rclpy._rclpy_pybind11'
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!
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.
I did follow the documentation step by step to finish this installation and don't know which step I got wrong.