How to define system dependencies in a custom package?
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?
Asked by Cerin on 2016-10-16 16:53:00 UTC
Answers
It seems to imply I'd document using the
<build_depend>
tags in mypackage.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?.
Asked by gvdhoorn on 2016-10-16 18:08:09 UTC
Comments
Does rosdep respect the standard setup.py script, which can list it's own PyPI dependencies?
Asked by Cerin on 2016-10-16 19:22:57 UTC
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.
Asked by gvdhoorn on 2016-10-17 00:31:31 UTC
Question answered? If so, please mark it as such by ticking the checkbox to the left of the answer. Thanks.
Asked by gvdhoorn on 2016-10-18 14:00:50 UTC
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.
Asked by Dirk Thomas on 2016-10-18 14:35:10 UTC
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.
Asked by Cerin on 2016-10-18 15:46:20 UTC
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.
Asked by gvdhoorn on 2016-10-18 16:20:19 UTC
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.
Asked by gvdhoorn on 2016-10-18 16:22:37 UTC
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.
Asked by Dirk Thomas on 2016-10-18 17:30:24 UTC
Comments