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

Catkin_make not installing Python dependencies

asked 2016-03-16 12:06:20 -0500

Cerin gravatar image

How do you make catkin_make install all Python package dependencies via pip?

I've written a simple Python package with a file like:

#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
    package_dir={'': 'src'},

And my CMakeLists.txt includes catkin_python_setup().

However, when I run catkin_make and source devel/, somepackage isn't installed into the virtual environment.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-26 06:39:32 -0500

peci1 gravatar image

updated 2017-01-26 07:16:39 -0500

I wouldn't expect catkin_make to do that.

Instead, I'd expect rosdep to do that, however, it doesn't generally. Most python packages are defined in the rosdep distribution files in the form python-packagename. So you can add a run dependency on python-somepackage into package.xml and let rosdep install the package.

However, not all pip-installable packages are in rosdep's distribution lists. E.g. numpy and scikit-learn are there (as python-numpy and python-sklearn ), but tensorflow is not. When the package is not present, you are, to my best knowledge, out of luck, and have to install it manually (or you can open a Pull request to rosdistro to add the pip package: )

You can verify by issuing

rosdep resolve python-somepackage
edit flag offensive delete link more



@peci1 you are right. However, if you need a pip package which is somehow usable for the broader public, simply provide the respective rosdep rule:

mgruhler gravatar image mgruhler  ( 2017-01-26 06:58:19 -0500 )edit

Thanks, I've edited the answer.

peci1 gravatar image peci1  ( 2017-01-26 07:16:58 -0500 )edit

This led me to ask on the catkin issue tracker, what's actually the requires field doing. The answer is simple: nothing. Do not use it in ROS. I've added a few comments to the documentation, so that people are warned about that. Details here:

peci1 gravatar image peci1  ( 2017-01-26 18:04:20 -0500 )edit

Question Tools



Asked: 2016-03-16 12:06:20 -0500

Seen: 1,822 times

Last updated: Jan 26 '17