Ask Your Question
0

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

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

Rextab gravatar image

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

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
ROS_VERSION=2
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/opt/openrobots/share:
ROS_DISTRO=dashing

$ env | grep dashig
LD_LIBRARY_PATH=/opt/ros/dashing/opt/yaml_cpp_vendor/lib:/opt/ros/dashing/opt/rviz_ogre_vendor/lib:/opt/ros/dashing/lib:/opt/openrobots/lib/dynamic-graph-plugins:/opt/openrobots/lib:
AMENT_PREFIX_PATH=/opt/ros/dashing
PYTHONPATH=/opt/ros/dashing/lib/python3.6/site-packages:/opt/openrobots/lib/python3.6/site-packages:
PATH=/opt/ros/dashing/bin:/opt/openrobots/bin:/home/mnaveau/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:bin:/usr/games:/usr/local/games:/snap/bin
ROS_DISTRO=dashing

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/utilities.py in ok(context)
     46 def ok(*, context=None):
     47     if context is None:
---> 48         context = get_default_context()
     49     return context.ok()
     50 

/opt/ros/dashing/lib/python3.6/site-packages/rclpy/utilities.py 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/context.py in __init__(self)
     26 
     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/implementation_singleton.py in <module>
     29 from rclpy.impl import _import
     30 
---> 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/__init__.py 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/__init__.py in import_module(name, package)
    124                 break
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 
    128 

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/Installation-Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions

Error received: $ ros2 topic list

Failed to load entry point 'launch': 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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

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

Rextab gravatar image

This question is I believe related to this one: - https://answers.ros.org/question/3465...

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

Comments

Indeed, thank you so much for this! A setcap on my Python executable was the reason for rosout terminating immediately due to not finding libroscpp.so (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 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 1,583 times

Last updated: Nov 26 '20