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

ERROR : ROS2 RUN package not found

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

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

Comments

1

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 setup.py/cfg

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

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 -0600 )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 -0600 )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 -0600 )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 -0600 )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 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
1

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

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

Comments

This worked for me! Thank you for your answer.

Carter12s gravatar image Carter12s  ( 2022-11-30 18:12:57 -0600 )edit

I tried using this but it didnt work for me

Ricky23 gravatar image Ricky23  ( 2022-12-10 04:38:34 -0600 )edit
1

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

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

Comments

Opening a new terminal did the trick for me!

Micha Sende gravatar image Micha Sende  ( 2023-03-03 02:54:42 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 27,562 times

Last updated: Jul 05 '22