Error with ROS2 Humble and Isaac SIM 4.0: rclpy failed to be imported while being present on the system

Hi, I am having some problems in running Isaac SIM 4.0 with ROS2.
I added in an empty scene the ROS2 clock setup from isaac utils tab and when I run ros2 topic list or any ros command I get an error saying that the C extension rclpy failed to be imported while being present on the system.
Here is the complete error:

Traceback (most recent call last):
  File "/opt/ros/humble/bin/ros2", line 33, in <module>
    sys.exit(load_entry_point('ros2cli==0.18.11', 'console_scripts', 'ros2')())
  File "/opt/ros/humble/bin/ros2", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/cli.py", line 22, in <module>
    from rclpy.executors import ExternalShutdownException
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/__init__.py", line 49, in <module>
    from rclpy.signals import install_signal_handlers
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/signals.py", line 15, in <module>
    from rclpy.exceptions import InvalidHandle
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/exceptions.py", line 15, in <module>
    from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/impl/implementation_singleton.py", line 32, in <module>
    rclpy_implementation = import_c_library('._rclpy_pybind11', package)
  File "/opt/ros/humble/lib/python3.10/site-packages/rpyutils/import_c_library.py", line 39, in import_c_library
    return importlib.import_module(name, package=package)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: /opt/ros/humble/lib/librcl_logging_spdlog.so: undefined symbol: _ZN6spdlog7details7log_msgC1ENS_10source_locEN3fmt2v817basic_string_viewIcEENS_5level10level_enumES6_
The C extension '/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/_rclpy_pybind11.cpython-310-x86_64-linux-gnu.so' failed to be imported while being present on the system. Please refer to 'https://docs.ros.org/en/{distro}/Guides/Installation-Troubleshooting.html#import-failing-even-with-library-present-on-the-system' for possible solutions

after the error, ROS2 on my system resume working only after a reboot.

Using Isaac SIM 2023.1.1 on the same machine I have no issues and everything works

How can I solve this problem?

It might be helpful to test ROS 2 commands without launching Isaac Sim to isolate whether the problem is with ROS 2 itself or its interaction with Isaac Sim. If the issue occurs even without Isaac Sim running, it’s likely a ROS 2 configuration problem that needs to be addressed first.

It might be helpful to test ROS 2 commands without launching Isaac Sim to isolate whether the problem is with ROS 2 itself or its interaction with Isaac Sim. If the issue occurs even without Isaac Sim running, it’s likely a ROS 2 configuration problem that needs to be addressed first.

Hi, thank you for answering! i am fairly sure that the problem is not of ROS2 itself as it started appearing only after I launched IsaacSim 4.0.
ROS2 has been used without issues without Isaac Sim and using IsaacSim 2023.1.1

I did some tests and I discovered that the issue arise when changing the DDS after having started Isaac Sim with another DDS implementation.
Minimal set of steps to reproduce:

  • With fastDDS enabled (RMW_IMPLEMENTATION environment variable set) start Isaac Sim 4.0 with the ros2 extension.
  • After Isaac Sim opened close it without opening a project or anything.
  • Set the RMW_IMPLEMENTATION to rmw_cyclonedds_cpp in the bashrc file
  • Start again Isaac Sim 4.0
  • Doing ros2 topic list on a freshly opened terminal trigger the error.

By removing the Isaac Sim steps in the previous list ROS2 still works without errors.

Anyway, there is a way to restore the system to a working state when the problem starts appearing? I have found that restarting the system is the only solution, I also tried ros2 daemon stop/start and changing again the DDS to Cyclone but it didn’t worked.