0
$\begingroup$

Rosanswers logo

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?


Originally posted by khassanov on ROS Answers with karma: 31 on 2019-09-30

Post score: 0


Original comments

Comment by khassanov on 2019-09-30:
While answers recommends rosdep, this one: https://answers.ros.org/question/310728/rosdep-and-ros2/ can help as well.

Comment by tfoote on 2019-09-30:
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.

Comment by khassanov on 2019-10-02:
Rosdep uses own package registry not connected with pypi.org. There is a list of Python packages available: https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml. More information is here: https://docs.ros.org/independent/api/rosdep/html/contributing_rules.html

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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)

Originally posted by tfoote with karma: 58457 on 2019-09-30

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.

colcon explicitly does not target to install any dependencies for you (see https://colcon.readthedocs.io/en/released/developer/design.html#explicitly-out-of-scope). It leaves this part to other tools (like rosdep).


Originally posted by Dirk Thomas with karma: 16276 on 2019-09-30

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

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