Ask Your Question

ERROR : ROS2 RUN package not found

asked 2020-04-01 04:03:32 -0500

rd112 gravatar image

colcon build --packages-select -build my package with this instruction.

trying to run a publisher node

ros2 run [package_name] talker

ERROR: package not found

edit retag flag offensive close merge delete



This is very limited information. How is composed your package? Is it a python or cmake package? Does it install an executable named talker ? if yes to what location ?

Please consider profiding more information and relevant bits of code like your CMakeLists or

marguedas gravatar image marguedas  ( 2020-04-01 07:46:29 -0500 )edit

Did you source the setup file generated by the colcon build command? e.g. install/setup.bash

jacobperron gravatar image jacobperron  ( 2020-04-01 11:22:40 -0500 )edit

Getting the same error, followed the tutorial step by step, using Python package on Windows. When I run ros2 run my_package my_node I get Package 'my_package' not found

sabin gravatar image sabin  ( 2021-02-02 08:36:44 -0500 )edit

The issue was that I called install/local_setup.bat (as indicated in the tutorial). Calling '.\install\setup.ps1' fixies the issue.

sabin gravatar image sabin  ( 2021-02-02 08:51:13 -0500 )edit

Everytime you build a package, always remember to do (from your ROS2 workspace): source install/setup.bash and source /opt/ros/foxy/setup.bash

fabbro gravatar image fabbro  ( 2022-03-08 01:55:52 -0500 )edit

@fabbro, why do I need to source two setup.bash files? i.e., source install/setup.bash and source /opt/ros/foxy/setup.bash

misty gravatar image misty  ( 2022-04-04 11:41:06 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2022-07-05 11:23:34 -0500

Roberto Z. gravatar image

In my case I was running colcon build form inside the src directory in my workspace.
Like this:

~/ros2_ws/src$ colcon build

Running colcon build in the workspace root solved the issue:

cd ~/ros2_ws
colcon build
source install/setup.bash

and finally

ros2 run [package_name] [executable_name]
edit flag offensive delete link more

answered 2022-06-30 13:08:41 -0500

randy gravatar image

If you have your ros2 configuration sourced from your shell's rc file (example: source /opt/ros/<your version>/setup.bash in the .bashrc file when using bash), then you need to source the appropriate install script for your application:

When you open a new shell/terminal, source install/setup.bash for bash, etc.

If you do not have the line mentioned above in your rc file (for example, you prefer to control this manually), then you need to source both files.

(I find answers easier to digest than comments. All of this info is in the comments.)

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2020-04-01 04:03:32 -0500

Seen: 4,366 times

Last updated: Jul 05