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

[ROS 2] Machine Learning Tutorial - Could not import 'rosidl_typesupport_c' for package 'turtlebot3_msgs'

asked 2020-07-04 12:00:03 -0600

EDS gravatar image

updated 2022-06-29 21:19:52 -0600

jayess gravatar image

Hello, I found an issue about the tutorial ( ) section 24.3.1 Stage 1 (No Obstacle), the issue is when I execute the sentence:

$ ros2 run turtlebot3_dqn dqn_environment

The following sentences were executed correctly ...

$ ros2 launch turtlebot3_gazebo 

$ ros2 run turtlebot3_dqn dqn_gazebo 1

But the sentence:

$ ros2 run turtlebot3_dqn dqn_environment

generate the following error:

(base) eds@ubuntu:~$ ros2 run turtlebot3_dqn dqn_environment 

Traceback (most recent call last): File "/opt/ros/dashing/lib/python3.6/site-packages/rosidl_generator_py/", line 40, in import_type_support return importlib.import_module(module_name, package=pkg_name) File "/usr/lib/python3.6/importlib/", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap="">", line 994, in _gcd_import File "<frozen importlib._bootstrap="">", line 971, in _find_and_load File "<frozen importlib._bootstrap="">", line 953, in _find_and_load_unlocked ModuleNotFoundError: No module named 'turtlebot3_msgs.turtlebot3_msgs_s__rosidl_typesupport_c'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/eds/turtlebot3_ws/install/turtlebot3_dqn/lib/turtlebot3_dqn/dqn_environment", line 11, in <module> load_entry_point('turtlebot3-dqn', 'console_scripts', 'dqn_environment')() File "/home/eds/turtlebot3_ws/build/turtlebot3_dqn/turtlebot3_dqn/dqn_environment/", line 250, in main dqn_environment = DQNEnvironment() File "/home/eds/turtlebot3_ws/build/turtlebot3_dqn/turtlebot3_dqn/dqn_environment/", line 92, in __init__ self.dqn_com_server = self.create_service(Dqn, 'dqn_com', self.dqn_com_callback) File "/opt/ros/dashing/lib/python3.6/site-packages/rclpy/", line 1219, in create_service check_for_type_support(srv_type) File "/opt/ros/dashing/lib/python3.6/site-packages/rclpy/", line 29, in check_for_type_support msg_type.__class__.__import_type_support__() File "/home/eds/turtlebot3_ws/install/turtlebot3_msgs/lib/python3.7/site-packages/turtlebot3_msgs/srv/", line 331, in __import_type_support__ module = import_type_support('turtlebot3_msgs') File "/opt/ros/dashing/lib/python3.6/site-packages/rosidl_generator_py/", line 42, in import_type_support raise UnsupportedTypeSupport(pkg_name) rosidl_generator_py.import_type_support_impl.UnsupportedTypeSupport: Could not import 'rosidl_typesupport_c' for package 'turtlebot3_msgs' (base) eds@ubuntu:~$

I had installed Ubuntu 18.04, Anaconda with python 3.7, ROS2, and Gazebo 9.

Can you help me please...

Thanks a lot.



edit retag flag offensive close merge delete



Since Anaconda is not part of the tutorial I would suggest trying it with the standard Python interpreter instead.

Dirk Thomas gravatar image Dirk Thomas  ( 2020-07-06 12:11:51 -0600 )edit

Hello, for me the same error message is being generated when I am trying to use a custom service that was created in a C++ project in Python. Has there been any progress on this issue?

doekaschi gravatar image doekaschi  ( 2020-07-16 07:55:15 -0600 )edit

Thanks Dirk, for me is Ok.

EDS gravatar image EDS  ( 2020-09-19 16:46:08 -0600 )edit

Guys, delete all the content of the folder install and try again

Andromeda gravatar image Andromeda  ( 2021-07-20 02:52:21 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2020-07-17 01:32:44 -0600

doekaschi gravatar image

I had the same issue and did some research to fix it. For me, the problem was, that I had not declared the dependencies of the message(s) correctly when defining it in the CMakeLists.txt. For furhter info, please check out this question that solved my issue:

edit flag offensive delete link more


hi, I got into the same issue as OP. As I am following the tutorial, I am not sure which message(s) are you referring. Can you give more hints on what did you do to fix the issue?

flint1025 gravatar image flint1025  ( 2020-10-26 04:11:30 -0600 )edit

answered 2022-06-28 09:50:30 -0600

m2-farzan gravatar image

This might be caused by your .action files being in a location other than {package_directory}/action/. Move them to the correct path, clean build/* and install/*, and rebuild. Also make sure to include <depend>action_msgs</depend> in your package.xml file.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2020-07-04 12:00:03 -0600

Seen: 28,713 times

Last updated: Jun 29 '22