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

How to define system dependencies in a custom package?

asked 2016-10-16 16:53:00 -0500

Cerin gravatar image

I'm trying to create a new Python ROS package, and it depends on a Python package (libzbar-cffi) and an Ubuntu system package (libzbar-dev). However, the tutorials don't fully explain how to document these so they're installed automatically. It seems to imply I'd document using the <build_depend> tags in my package.xml, but it's unclear what name I'm supposed to use in these tags. The example names shown don't correspond to any explicit package on Ubuntu.

To install my package manually, I need to run:

sudo apt-get install libzbar-dev
sudo pip install libzbar-cffi

How do I structure my package so installing it via catkin_make does this automatically?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-10-16 18:08:09 -0500

gvdhoorn gravatar image

updated 2016-10-16 18:15:25 -0500

It seems to imply I'd document using the <build_depend> tags in my package.xml, but it's unclear what name I'm supposed to use in these tags. The example names shown don't correspond to any explicit package on Ubuntu.

(I can't find it right now, but I'm actually pretty sure there is a document/tutorial explaining this. I'll add a link if I come across it.)

Basically, to be able to encode system dependencies in your package.xml, the (debian) packages you want to depend on must be known to a tool called rosdep via its rule database. For packages that aren't yet part of it, you'd need to contribute some rules. That would come down to picking a name for the key, and providing the mappings to the actualy packages on a nr of Linux distributions.

One potential problem here is that (as far as I know), rosdep cannot install pip dependencies for you. Your libzbar-dev is fine, but libzbar-cffi is problematic. Searching a bit shows that Ubuntu has packaged python-zbar as a debian (here). If that is recent enough, you could add rules for that and list it in your manifest.

Note that the rosdep database already contains a mapping for libzbar-dev: here.

How do I structure my package so installing it via catkin_make does this automatically?

Note that installing system dependencies is not catkin's job, that would be rosdep.

For why we use rosdep in ROS, and not plain Ubuntu/Fedora/X package names, see Why rosdep instead of others?.

edit flag offensive delete link more

Comments

Does rosdep respect the standard setup.py script, which can list it's own PyPI dependencies?

Cerin gravatar image Cerin  ( 2016-10-16 19:22:57 -0500 )edit
1

No. It could perhaps be done, but right now rosdep only uses the information in the manifest. CMakeLists.txt vs package.xml discusses a similar situation (duplication of information and why).

Note that ament in ROS2 can build regular Python pkgs.

gvdhoorn gravatar image gvdhoorn  ( 2016-10-17 00:31:31 -0500 )edit

Question answered? If so, please mark it as such by ticking the checkbox to the left of the answer. Thanks.

gvdhoorn gravatar image gvdhoorn  ( 2016-10-18 14:00:50 -0500 )edit

For ROS 2 the same limitations still applies: in order to create a Debian package all dependencies must be available as Debian package. E.g. a Debian package can not depend on a package installed via PIP.

Dirk Thomas gravatar image Dirk Thomas  ( 2016-10-18 14:35:10 -0500 )edit

gvdhoorn, Unfortunately, no. I still need a formal way to install Pip packages. Pip is the package management tool for Python, so not being able to officially use that in ROS is a huge problem for the framework. Relying on system packages alone isn't enough, because these are usually outdated.

Cerin gravatar image Cerin  ( 2016-10-18 15:46:20 -0500 )edit

I'm not sure whether pip is supported by rosdep. In 'the old days', pkgs could ship with a pkg-local yaml file that could run just about any command, including pip. @Dirk Thomas should know whether that is still supported.

gvdhoorn gravatar image gvdhoorn  ( 2016-10-18 16:20:19 -0500 )edit
1

gvdhoorn, Unfortunately, no. I still need a formal way to install Pip packages

Then I feel like you should've asked your question differently. Right now it's titled "how to define system dependencies", which I'd say I answered. It may not be the answer you're looking for, but these are the facts.

gvdhoorn gravatar image gvdhoorn  ( 2016-10-18 16:22:37 -0500 )edit
4

A package can mention a rosdep key in its manifest and that key can be mapped to a PIP package. rosdep will perfectly work with that. You just can't call bloom for that package since it can't determine the Debian control file for non-Debian dependencies - hence no release.

Dirk Thomas gravatar image Dirk Thomas  ( 2016-10-18 17:30:24 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-10-16 16:53:00 -0500

Seen: 2,304 times

Last updated: Oct 16 '16