Cannot run ROS2 node in Pycharm
Hi, I am trying to run any ROS2 node in Pycharm and I always get the same error:
/home/developer/anaconda3/bin/python /home/developer/task-manager/ros2_ws/src/gui/gui_pkg/gui_node.py
Traceback (most recent call last):
File "/home/developer/task-manager/ros2_ws/src/gui/gui_pkg/gui_node.py", line 3, in <module>
from rclpy.node import Node
File "/opt/ros/dashing/lib/python3.6/site-packages/rclpy/node.py", line 39, in <module>
from rclpy.client import Client
File "/opt/ros/dashing/lib/python3.6/site-packages/rclpy/client.py", line 22, in <module>
from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
File "/opt/ros/dashing/lib/python3.6/site-packages/rclpy/impl/implementation_singleton.py", line 31, in <module>
rclpy_implementation = _import('._rclpy')
File "/opt/ros/dashing/lib/python3.6/site-packages/rclpy/impl/__init__.py", line 21, in _import
return importlib.import_module(name, package='rclpy')
File "/home/developer/anaconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: librclpy_common.so: cannot open shared object file: No such file or directory
The C extension '/opt/ros/dashing/lib/python3.6/site-packages/rclpy/_rclpy.cpython-36m-x86_64-linux-gnu.so' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
I installed Python 3.6.2. through anaconda and I am using ROS2 dashing. If I run a node from terminal it works but through Pycharm does not (I would prefer run it from Pycharm for debugging purposes). I have added several Interpreter Paths
in Settings
in Pycharm:
/home/developer/anaconda3/lib/python3.6
/home/developer/anaconda3/lib/python3.6/lib-dynload
/home/developer/anaconda3/lib/python3.6/site-packages
/opt/ros/dashing/lib/python3.6/site-packages
Before, I had python installed not from anaconda and the error was the same.
Asked by hect1995 on 2019-07-25 02:12:39 UTC
Comments
Did you source your ros2 installation in a terminal, then start pycharm from that same terminal?
Asked by ChuiV on 2019-07-25 09:10:16 UTC