RQT ModuleNotFoundError: No module named 'rclpy._rclpy'
I get the following error when running rqt on MacOs (Mohave)
Traceback (most recent call last):
File "/Users/ros/ros2_foxy/ros2-osx/bin/rqt", line 33, in <module>
sys.exit(load_entry_point('rqt-gui==1.0.6', 'console_scripts', 'rqt')())
File "/Users/ros/ros2_foxy/ros2-osx/lib/python3.8/site-packages/rqt_gui/main.py", line 87, in main
sys.exit(Main().main())
File "/Users/ros/ros2_foxy/ros2-osx/lib/python3.8/site-packages/rqt_gui/main.py", line 55, in main
argv = rclpy.utilities.remove_ros_args(args=argv)
File "/Users/ros/ros2_foxy/ros2-osx/lib/python3.8/site-packages/rclpy/utilities.py", line 44, in remove_ros_args
from rclpy.impl.implementation_singleton import rclpy_implementation
File "/Users/ros/ros2_foxy/ros2-osx/lib/python3.8/site-packages/rclpy/impl/implementation_singleton.py", line 31, in <module>
rclpy_implementation = _import('._rclpy')
File "/Users/ros/ros2_foxy/ros2-osx/lib/python3.8/site-packages/rclpy/impl/__init__.py", line 28, in _import
return importlib.import_module(name, package='rclpy')
File "/usr/local/Cellar/python@3.9/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'rclpy._rclpy'
The C extension '/Users/ros/ros2_foxy/ros2-osx/lib/python3.8/site-packages/rclpy/_rclpy.cpython-39-darwin.so' isn't present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/Installation-Troubleshooting/#import-failing-without-library-present-on-the-system' for possible solutions
It appears that at some point along the way the python version switches from 3.8 to 3.9
Asked by mjwhite on 2020-12-01 20:41:24 UTC
Answers
It looks like the python3 version got upgraded after running Homebrew to install another package as seen by:
python3 --version
Python 3.9.0
I removed the symbolic link and pointed it to the previous version
rm /usr/local/bin/python3
ln -s /usr/local/Cellar/python@3.8/3.8.6_1/bin /usr/local/bin/python3
rqt ran sucessfully after that.
Asked by mjwhite on 2020-12-01 20:47:09 UTC
Comments