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

setup.py not installing python module during catkin build

asked 2017-10-15 21:13:49 -0500

Hi, I'm trying to install a python module defined in a ros package using the guide defined here. However I find that my package defined in the:

<rospackage>/src/<my_python_pkg>/*.*

is not showing up in the the install/lib/python/dist-utils of my build. I only get the __init__.py from my package installed there.

The contents of my package include multiple subpackages but these folders are not being copied at all. However, two of my scripts that have been defined in the catkin_install_python() function of CMakeLists.txt do show up.

I am using catkin build tools, and my package.xml has a build dependency on rospy, if that matters.

Any guidance would be appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
6

answered 2017-10-15 22:58:18 -0500

Okay, when developing and installing a multilevel package, the package and all subpackages must be included in the setup.py such as:

## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD

from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup

# fetch values from package.xml
setup_args = generate_distutils_setup(
    packages=['hm_analysis_tools', 
              'pakage_name.subpackage1.subsubpackage',
              'pakage_name.subpackage1.subsubpackage2'],
    package_dir={'': 'src'},
)

setup(**setup_args)

for a package space as:

<ros_package>/
  src/
    package/
       subpackage1/
            subsubpackage1/
            subsubpackage2/
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-10-15 21:13:49 -0500

Seen: 1,583 times

Last updated: Oct 15 '17