When creating a new catkin workspace, building it and then sourcing devel/setup.sh, the ROS_PACKAGE_PATH is populated with paths from individual packages instead of only the root directory that contains all the packages. The packages are still found when calling roslaunch and all works fine, but my understanding is that ROS_PACKAGE_PATH should only contain the root directory. For example, I create a new catkin workspace:

source /opt/ros/melodic/setup.bash
echo $ROS_PACKAGE_PATH # prints /opt/ros/melodic/share
mkdir -p $HOME/test_ws/src
cd $HOME/test_ws/src
#copy / create packages pkg1, pkg2, ...
cd $HOME/test_ws
catkin build
source devel/setup.bash
echo $ROS_PACKAGE_PATH # at this point, i would expect 
#$HOME/test_ws/src:/opt/ros/melodic/share, instead i get

Is this the normal behavior or am I doing something wrong here?


1 Answer 1


Seems like this is the expected behavior of catkin build as stated on the Migrating from catkin_make website:

It generates .catkin files where each source package is listed, individually, instead of just listing the source space for the workspace. This leads to similar ROS_PACKAGE_PATH variables which list each package source space.

If using the catkin_make, however, it does add only the root/source path of the workspace, as i expected initially.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.