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

Best practices to manage ROS2 package python dependencies

asked 2019-09-30 07:21:45 -0600

khassanov gravatar image

What the best practice to manage / install dependencies for ROS2 python package? Installing by setup.py? Using system-level or an interpreter in venv with requirements.txt to install dependencies with pip manually? Can colcon trigger installation from pypi on a build stage?

edit retag flag offensive close merge delete

Comments

While answers recommends rosdep, this one: https://answers.ros.org/question/3107... can help as well.

khassanov gravatar image khassanov  ( 2019-09-30 16:18:51 -0600 )edit

That answer is out of date, and all core dependencies are available from debian packages now. And pip dependencies can be resolved by rosdep, they just can't be released into debian paickages.

tfoote gravatar image tfoote  ( 2019-09-30 16:29:25 -0600 )edit

Rosdep uses own package registry not connected with pypi.org. There is a list of Python packages available: https://raw.githubusercontent.com/ros.... More information is here: https://docs.ros.org/independent/api/...

khassanov gravatar image khassanov  ( 2019-10-02 03:09:17 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2019-09-30 12:42:57 -0600

Dirk Thomas gravatar image

A ROS package must specify its dependencies in the package.xml file. Simply because that is the information being used to e.g. release a package with bloom into a Debian package.

With that information available you can then use rosdep to install the dependencies according to the platform you are on. On Ubuntu it should be Debian packages (otherwise you wouldn't be able to create a Debian package of your package). On other platforms rosdep will use pip.

colconexplicitly does not target to install any dependencies for you (see https://colcon.readthedocs.io/en/rele...). It leaves this part to other tools (like rosdep).

edit flag offensive delete link more
1

answered 2019-09-30 12:42:56 -0600

tfoote gravatar image

It's strongly recommended to use system dependencies declared in the package.xml file and then standard tools like rosdep can both check and resolve them.

colcon is a build tool. We have specifically separated build and install stages for cleaner separation of concerns as well as to avoid side effects that might have security implications.

A standard practice is to:

  1. Download a set of packages into a workspace (using a rosinstall file or repos file and vcstool)
  2. Install all dependencies of that workspace (Using rosdep. It will error if anything is unresolved that you might need to maually resolve.)
  3. Run your build(with colcon)
edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2019-09-30 07:19:34 -0600

Seen: 5,886 times

Last updated: Sep 30 '19