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

How to use rosdep to install dependencies of a ROS 1 install folder (built by Colcon)

asked 2021-01-11 23:18:19 -0500

MikeWrock gravatar image

updated 2021-01-12 12:17:23 -0500

gvdhoorn gravatar image

I'm trying to build a Docker image that only has my install workspace, but I cannot get the dependencies to install. With the src folder present I would use rosdep install, but when I use colcon build in an intermediate container and only copy the install folder to my deployment image, rosdep install --default-yes --from-paths install --ignore-src -r does not install my unmet dependencies.

edit retag flag offensive close merge delete


You tagged this ROS1 and then mention Colcon. Are you using Colcon to build a ROS 1 workspace?

gvdhoorn gravatar image gvdhoorn  ( 2021-01-12 01:41:05 -0500 )edit

Yes, I have been using Colcon to build a ROS 1 workspace. Could that be the reason rosdep install won't install my dependencies?

MikeWrock gravatar image MikeWrock  ( 2021-01-12 01:50:03 -0500 )edit

It would be good if you could show what does happen when you run your command. A verbatim copy-paste of rosdep's output would be good.

gvdhoorn gravatar image gvdhoorn  ( 2021-01-12 01:56:45 -0500 )edit

I've just tested this with ros:melodic and a simple pkg depending on industrial_msgs (which is released but not part of ros:melodic).

After building everything in one container, then using the install folder in another ros:melodic container and the following rosdep command:

rosdep check --from-paths /path/to/catkin_ws/install -i --rosdistro=melodic

and rosdep correctly identified industrial_msgs to be missing.

This was with catkin_tools as the buildtool.

So this can work.

Edit: tried with colcon build --merge-install and without --merge-install and that changes things. rosdep does find the pkg, but doesn't seem to find anything missing.

gvdhoorn gravatar image gvdhoorn  ( 2021-01-12 02:04:52 -0500 )edit

Not sure, but I just remembered this could be due to ros-infrastructure/rosdep#724 (although that's specifically about ROS 2 and rosdep, Colcon is used there as well, which may be a common factor). Could also not be related at all.

Easiest work-around for now: not using Colcon to build a ROS 1 workspace. It's actually not really a work-around: I don't believe there is a claim that Colcon can build all ROS 1 workspaces successfully. It's not officially supported.

gvdhoorn gravatar image gvdhoorn  ( 2021-01-12 02:19:12 -0500 )edit

If I understand what you're trying to do correctly, you may be interested in ros-infrastructure/rosdep#789, which allows you to ask rosdep to only install exec_depends, instead of all dependencies.

gvdhoorn gravatar image gvdhoorn  ( 2021-01-12 02:58:20 -0500 )edit

Final comment: your rosdep invocation includes the -r switch.

This will make rosdep ignore errors it may encounter while trying to install dependencies. It's up to you, but I would want to know when rosdep cannot install a specific dependency instead of just ignoring it, as it's probably something I would want to address.

I would suggest to remove the -r there.

gvdhoorn gravatar image gvdhoorn  ( 2021-01-12 12:18:45 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2021-01-12 02:46:21 -0500

gvdhoorn gravatar image

updated 2021-01-12 03:01:06 -0500

I'm not sure what the cause is yet, but the following works for me (ie: rosdep identifies the missing dependency correctly) with a ROS 1 workspace (ie: with Catkin packages) built by Colcon (in a ros:melodic container):

rosdep check --from-paths /path/to/catkin_ws/install/share --ignore-src --rosdistro=melodic

Note the share/ in the argument to --from-paths.

Without that, rosdep for some reason doesn't identify the missing dependency.

It does discover my test package though, so I'm not sure what's going on there.

Running with --verbose gives me:

resolving for resources [test_pkg]

when adding the share/, but:

resolving for resources []

without share/.

It's likely there is already an issue on ros-infrastructure/rosdep about this, but I haven't found it (yet) (edit: could actually be ros-infrastructure/rosdep#724).

Note: this is with --merge-install. I expect you'd have to list the paths to all share/ subdirs of all the pkgs in your workspace (ie: install/$pkg/share) otherwise.

Edit: this probably has something to do with rosdep only looking at the Ament Index when parsing workspaces built by Colcon, and only looking for files under share/ (and failing if they're not where it expects them to be), instead of crawling the hierarchy below catkin_ws/install.

edit flag offensive delete link more


Thank you very much, this solved my issue. Should I add a minimal working example in case someone else is stuck in a similar situation or do you think your answer gives sufficient information to reproduce the desired result?

MikeWrock gravatar image MikeWrock  ( 2021-01-12 11:46:00 -0500 )edit

You have a pretty niche use-case (building a ROS 1 workspace with Colcon). I would expect users who do that to understand the build workflow a bit better than others.

I believe the rosdep command I show as part of the answer is clear enough, in combination with the explanation below it.

if you feel providing a variant with install instead of check would help, you could post a comment here.

gvdhoorn gravatar image gvdhoorn  ( 2021-01-12 12:16:25 -0500 )edit

Could you please mark the question as answered by ticking the checkmark (✓) to the left of the answer if you feel it has been answered? Thanks.

gvdhoorn gravatar image gvdhoorn  ( 2021-01-12 12:16:55 -0500 )edit

Question Tools

1 follower


Asked: 2021-01-11 23:18:19 -0500

Seen: 621 times

Last updated: Jan 12 '21