Ask Your Question

install python node with colcon

asked 2020-07-31 11:13:00 -0500

luca.fancellu gravatar image

Hi everybody,

I'm developing a simple python node for, so during development I had my catkin workspace folder and to install everything I just used catkin_make command.

Here the folder structure of the node:

├── CMakeLists.txt
├── launch
│   └── node_launchfile.launch
├── nodes
│   └──
├── package.xml
└── src
    └── node_name
        ├── package_1
        ├── package_2
        ├── package_3
        └── package_n

The content of is:

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

d = generate_distutils_setup(packages=['node_name'],
                             package_dir={'': 'src'})

CMakeLists.txt contains the python stuff:

find_package(catkin REQUIRED COMPONENTS

Now I'm trying to use colcon to build/install the node using:

colcon build --cmake-clean-cache --packages-up-to node_name

But when I run the node then I get:

[ERROR] [1596211499.485229]: Error loading the module package_1:
No module named node_name.package_1

So it seems like that the packages are not installed. Anyone can give me some help?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-07-31 11:23:02 -0500

Dirk Thomas gravatar image

Your setup file explicitly only installs the module node_name - but not any of the submodules.

Instead of explicitly enumerating all submodules you probably want to use setuptools.find_packages() to discover all Python modules automatically and pass them to the packages keyword argument.

edit flag offensive delete link more


I'm sure that it works, but I end up listing the packages and package dirs by hand and it worked. Thank you for your support

luca.fancellu gravatar image luca.fancellu  ( 2020-08-03 05:43:21 -0500 )edit

Please mark the answer with the check mark on the left of it as answered if it did answer your question.

Dirk Thomas gravatar image Dirk Thomas  ( 2020-08-03 09:50:13 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-07-31 11:13:00 -0500

Seen: 85 times

Last updated: Jul 31 '20