Cannot run ROS2 node in Pycharm

asked 2019-07-25 02:12:39 -0500

hect1995 gravatar image

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/
Traceback (most recent call last):
  File "/home/developer/task-manager/ros2_ws/src/gui/gui_pkg/", line 3, in <module>
    from rclpy.node import Node
  File "/opt/ros/dashing/lib/python3.6/site-packages/rclpy/", line 39, in <module>
    from rclpy.client import Client
  File "/opt/ros/dashing/lib/python3.6/site-packages/rclpy/", 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/", line 31, in <module>
    rclpy_implementation = _import('._rclpy')
  File "/opt/ros/dashing/lib/python3.6/site-packages/rclpy/impl/", line 21, in _import
    return importlib.import_module(name, package='rclpy')
  File "/home/developer/anaconda3/lib/python3.6/importlib/", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: cannot open shared object file: No such file or directory
The C extension '/opt/ros/dashing/lib/python3.6/site-packages/rclpy/' failed to be imported while being present on the system. Please refer to '' 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:


Before, I had python installed not from anaconda and the error was the same.

edit retag flag offensive close merge delete



Did you source your ros2 installation in a terminal, then start pycharm from that same terminal?

ChuiV gravatar image ChuiV  ( 2019-07-25 09:10:16 -0500 )edit