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

Catkin_make not installing Python dependencies

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

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 setup.py file like:

#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
    version='0.0.1',
    packages=['mypackage'],
    package_dir={'': 'src'},
    install_requires=['somepackage'],
)
setup(**d)

And my CMakeLists.txt includes catkin_python_setup().

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

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

peci1 gravatar image

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

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: http://docs.ros.org/independent/api/r... )

You can verify by issuing

rosdep resolve python-somepackage
edit flag offensive delete link more

Comments

1

@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: http://docs.ros.org/independent/api/r...

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

Thanks, I've edited the answer.

peci1 gravatar image peci1  ( 2017-01-26 07:16:58 -0600 )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: https://github.com/ros-infrastructure...

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

Question Tools

2 followers

Stats

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

Seen: 2,029 times

Last updated: Jan 26 '17