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

[ubuntu18.04][ros2-dashing] failed to load entry point issue

asked 2020-11-25 11:04:45 -0500

Rextab gravatar image

updated 2020-11-26 06:39:16 -0500

I am trying to run ros2 commands but with any of them I get a similar failure (see below).

edit: from further debugging (BTW it was working perfectly yesterday 24/11/2020) I guess that the LD_LIBRARY_PATH is not loaded or used by python in order to find and load the plugins libraries...

my configuration is Ubunut18.04, re-preempt, ROS2-binary Dashing:

$  env | grep ROS

$ env | grep dashig

moreover it happens from python with a simple:

$ ipython
Python 3.6.9 (default, Oct  8 2020, 12:12:24) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import rclpy

In [2]: rclpy.ok()
ImportError                               Traceback (most recent call last)
<ipython-input-2-1fc2aba2165f> in <module>
----> 1 rclpy.ok()

/opt/ros/dashing/lib/python3.6/site-packages/rclpy/ in ok(context)
     46 def ok(*, context=None):
     47     if context is None:
---> 48         context = get_default_context()
     49     return context.ok()

/opt/ros/dashing/lib/python3.6/site-packages/rclpy/ in get_default_context(shutting_down)
     29         global g_default_context
     30         if g_default_context is None:
---> 31             g_default_context = Context()
     32         if shutting_down:
     33             old_context = g_default_context

/opt/ros/dashing/lib/python3.6/site-packages/rclpy/ in __init__(self)
     27     def __init__(self):
---> 28         from rclpy.impl.implementation_singleton import rclpy_implementation
     29         self._handle = rclpy_implementation.rclpy_create_context()
     30         self._lock = threading.Lock()

/opt/ros/dashing/lib/python3.6/site-packages/rclpy/impl/ in <module>
     29 from rclpy.impl import _import
---> 31 rclpy_implementation = _import('._rclpy')
     32 rclpy_action_implementation = _import('._rclpy_action')
     33 rclpy_logging_implementation = _import('._rclpy_logging')

/opt/ros/dashing/lib/python3.6/site-packages/rclpy/impl/ in _import(name)
     20 def _import(name):
     21     try:
---> 22         return importlib.import_module(name, package='rclpy')
     23     except ImportError as e:
     24         if e.path is None:

/usr/lib/python3.6/importlib/ in import_module(name, package)
    124                 break
    125             level += 1
--> 126     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

Error received: $ ros2 topic list

Failed to load entry point 'launch': cannot open shared object file: No such file or directory
The C extension '/opt/ros/dashing/lib/python3.6/site-packages/rclpy/' failed ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-11-26 09:31:05 -0500

Rextab gravatar image

This question is I believe related to this one: -

I my case it is not an issue with the LD_LIBRARY_PATH that is not set but on capabilities that have been increased on the python executable. A sudo setcap cap_net_admin,cap_net_raw+ep /usr/bin/python3.6 has been executed. The problem with that is that for security reasons the LD_LIBRARY_PATH is ignored when one uses setcap. Hence python3.6 would not be able to find the the ros libraries, only the python package.

One issue I had to debug this is that the setcap is necessarily done on the executable and not on the symlink. Hence if you do getcap on python or python3 one will see nothing!

I hope this issue will help others!

edit flag offensive delete link more


Indeed, thank you so much for this! A setcap on my Python executable was the reason for rosout terminating immediately due to not finding (although properly installed, Ubuntu 20.04, ROS1 noetic). Was able to fix it with sudo setcap -r /usr/bin/python3.8.

CodeFinder gravatar image CodeFinder  ( 2021-06-08 08:29:34 -0500 )edit

sudo setcap -r /usr/bin/python3

hipforth gravatar image hipforth  ( 2022-03-30 21:13:07 -0500 )edit

This solves the problem. Thanks. However do you know why was this cap set and how ? do we need to always remove this cap ?

aks gravatar image aks  ( 2023-02-23 07:26:04 -0500 )edit

I need to have authorized with setcap when running the my python script. So how can I authorize both python and run ros?

pysoem issue with ros

miksi gravatar image miksi  ( 2023-06-03 02:10:00 -0500 )edit

Question Tools



Asked: 2020-11-25 11:04:45 -0500

Seen: 7,383 times

Last updated: Nov 26 '20