ros2 launch error: Failed to load entry point

asked 2022-02-28 20:40:31 -0500

huybeme gravatar image

Hello, I have been playing around with turtlebot3 burger installed with ubuntu 20.04 and ros2 foxy. My remote PC installed with the same setup as the turtlebot.

on my turtlebot, I am able to run ros2 launch turtlebot3_bringup or any launch files for that matter but cannot run launch files on the remote PC like below.

ros2 launch turtlebot3_cartographer

I get this error when I do try to launch something on the PC:

Failed to load entry point 'launch': [Errno 2] No such file or directory: '/home/hle/Desktop/compsci/ros/slam_capstone/install/launch/share/launch/frontend/grammar.lark'
Traceback (most recent call last):
  File "/opt/ros/foxy/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.9.11', 'console_scripts', 'ros2')()
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2cli/", line 39, in main
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2cli/command/", line 237, in add_subparsers_on_demand
    extension = command_extensions[name]
KeyError: 'launch'

I get this same error when running command

ros2 launch -h

Please let me know if there are any information needed that I may have left out.

edit retag flag offensive close merge delete


I have sort of found a work around solution at the moment would like to solve the problem at its root so here is what I did.

I went to ~/opt/ros/foxy/share/launch/ and copied the frontend/ folder to the directory on my error above. I also copied some of the dependencies from the package.xml and added it to the other directory's package.xml

so far I am able to run ros2 launch command properly now.

However, is there a way to correct the path/entry point to the launch command?

huybeme gravatar image huybeme  ( 2022-03-01 18:31:23 -0500 )edit

It would be nice to see how the launch file looks like, from this error message one can only deduce that something inside that launch file is pointing to a file that hasn't been copied to that directory during the building process (you can check you CMakeLists.txt for that).

Serafadam gravatar image Serafadam  ( 2022-03-10 18:35:51 -0500 )edit

Hi Serafadak, sorry for a very late response. Although I have found a work around when the error prompts, the issue still remains. Any launch file I run will run into this error. It seems like sometimes when I 'colcon build', something happens and the default directory for the launch grammar.lark file gets changed which is why I have to copy and paste the appropriate files to the directory stated in the error code. As for a launch file example, here is one that I always run that will prompt when this error pops up:

Is there a way do you know of that I can correct its directory for entry point back to the default /opt/ros/foxy directory?

huybeme gravatar image huybeme  ( 2022-05-09 21:53:13 -0500 )edit