Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing module __init__ in package containing messages and catkin_python_setup() #34

Closed
mikepurvis opened this issue Sep 12, 2013 · 11 comments
Assignees
Labels

Comments

@mikepurvis
Copy link
Member

Pretty sure this is a repeat of issue #10.

My package works fine in devel space, when I go to install it, I get this:

$ catkin_make install  | grep __init__
Compiling /home/mikepurvis/husky_ws/devel/lib/python2.7/dist-packages/clearpath_base/__init__.py ...
Compiling /home/mikepurvis/husky_ws/devel/lib/python2.7/dist-packages/clearpath_base/msg/__init__.py ...
-- Installing: /home/mikepurvis/husky_ws/install/lib/python2.7/dist-packages/clearpath_base/msg/__init__.pyc
-- Installing: /home/mikepurvis/husky_ws/install/lib/python2.7/dist-packages/clearpath_base/msg/__init__.py

The __init__.py file in the package root get compiled, but it never gets installed.

On a hunch, I finally removed catkin_python_setup(), and then it does the right thing and installs the __init__.py file:

$ catkin_make install  | grep __init__
Compiling /home/mikepurvis/husky_ws/devel/lib/python2.7/dist-packages/clearpath_base/__init__.py ...
Compiling /home/mikepurvis/husky_ws/devel/lib/python2.7/dist-packages/clearpath_base/msg/__init__.py ...
-- Installing: /home/mikepurvis/husky_ws/install/lib/python2.7/dist-packages/clearpath_base/__init__.pyc
-- Installing: /home/mikepurvis/husky_ws/install/lib/python2.7/dist-packages/clearpath_base/__init__.py
-- Installing: /home/mikepurvis/husky_ws/install/lib/python2.7/dist-packages/clearpath_base/msg/__init__.pyc
-- Installing: /home/mikepurvis/husky_ws/install/lib/python2.7/dist-packages/clearpath_base/msg/__init__.py

I know this is not an ideally-named package (or API design), but it's this way to maintain consistency with some historical decisions. The package source is here:

https://github.com/clearpathrobotics/clearpath_base

For now, I'm going to just work around this by manually installing the file, but it was a pretty nasty bug to figure out.


For interested parties, here's the workaround:

install(FILES ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_PYTHON_DESTINATION}/__init__.py
  DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION})
@tfoote
Copy link
Member

tfoote commented Sep 12, 2013

@wjwwood this might be the same problem you're having

@dirk-thomas
Copy link
Member

The problem why this happens in your case is that the message generation happens for the package name clearpath_base but the Python package(s) being installed are actually named differently.

I am not sure if and how this can be fixed in genmsg/catkin. I will have to look into it a bit more.

[The "right" solution would probably be to only have a Python package which matches the package name and if multiple package names are necessary split the ROS package into multiple ones.]

@mikepurvis
Copy link
Member Author

Okay, cool. The main frustration is that it's such a subtle failure—might be something to try to warn the user about at build time, or even refuse to build.

dirk-thomas added a commit to ros/catkin that referenced this issue Sep 13, 2013
….py when signaling that an __init__.py file is installed to genmsg/dynamic_reconfigure (ros/genmsg#34)
@ghost ghost assigned dirk-thomas Sep 13, 2013
dirk-thomas added a commit that referenced this issue Sep 13, 2013
dirk-thomas added a commit to ros/dynamic_reconfigure that referenced this issue Sep 13, 2013
@dirk-thomas
Copy link
Member

I have fixed the issue in the affected packages (catkin, genmsg, dynamic_reconfigure).

As soon as these packages are released (next days) you should revert your workaround (clearpathrobotics/clearpath_base@e0b4510) and add a versioned dependency to ensure that you depend on the latest version of the packages.

@mikepurvis
Copy link
Member Author

Hi Dirk—sorry to trouble you. How do I declare a versioned dependency? I checked out the package.xml page, and didn't see any mention of it.

Alternatively, is there any harm in just leaving it in? I can always zap it in a few weeks when the coast is definitely clear.

@wjwwood
Copy link
Member

wjwwood commented Sep 16, 2013

It is defined in the REP:

http://www.ros.org/reps/rep-0127.html#build-depend-multiple

@dirk-thomas
Copy link
Member

I am not sure if the install rules will collide?

Since your package will rely on a specific minimum version of another package it should declare that. Nothing prevents a user from having an older version of e.g. catkin/genmsg installed but updated your package.

@mikepurvis
Copy link
Member Author

Hmm, okay. I believe I've made the correct changes in the following branch: https://github.com/clearpathrobotics/clearpath_base/compare/genmsg_workaround_removal

Once you've released catkin 0.5.74 and genmsg 0.4.23, then I'll merge that branch and cut a new release of clearpath_base.

@dirk-thomas
Copy link
Member

The changes on the branch look good - I will comment as soon as the packages are released.

@dirk-thomas
Copy link
Member

The packages have been released so you can go ahead and also release your packages.

@mikepurvis
Copy link
Member Author

Package is released and works great, thanks. I appreciate the hand-holding.

severin-lemaignan referenced this issue in severin-lemaignan/robotpkg Aug 18, 2014
Changes since 0.4.20:

0.5.3 (2014-07-10)
------------------
* escape messages to avoid CMake warning (`#49
<https://github.com/ros/genmsg/issues/49>`_)

0.5.2 (2014-05-07)
------------------
* refactor to generate pkg-msg-paths.cmake via configure_file() instead of empy
(`#43 <https://github.com/ros/genmsg/issues/43>`_)
* fix python 3 compatibility (`#45 <https://github.com/ros/genmsg/issues/45>`_)
* remove debug message introduced in 0.5.1 (`#42
<https://github.com/ros/genmsg/issues/42>`_)

0.5.1 (2014-03-04)
------------------
* add check for changed message dependencies (`#41
<https://github.com/ros/genmsg/issues/41>`_)

0.5.0 (2014-02-25)
------------------
* remove usage of debug_message() (`#40
<https://github.com/ros/genmsg/issues/40>`_)

0.4.24 (2014-01-07)
-------------------
* python 3 compatibility (`#36 <https://github.com/ros/genmsg/issues/36>`_,
`#37 <https://github.com/ros/genmsg/issues/37>`_)
* add support for ROS_LANG_DISABLE env variable (`ros/ros#39
<https://github.com/ros/ros/issues/39>`_)
* fix installation of __init__.py from devel space (`#38
<https://github.com/ros/genmsg/issues/38>`_)

0.4.23 (2013-09-17)
-------------------
* fix installation of __init__.py file for packages where name differs from
project name (`#34 <https://github.com/ros/genmsg/issues/34>`_)
* rename variable 'config' to not collide with global variable (`#33
<https://github.com/ros/genmsg/issues/33>`_)
* fix service files variable to only contain package relative paths (`#32
<https://github.com/ros/genmsg/issues/32>`_)

0.4.22 (2013-08-21)
-------------------
* make genmsg relocatable (`ros/catkin#490
<https://github.com/ros/catkin/issues/490>`_)
* add warning in case generate_messages() is invoked without any messages and
services (`#31 <https://github.com/ros/genmsg/issues/31>`_)
* check if files have been generated before trying to install them (`#31
<https://github.com/ros/genmsg/issues/31>`_)

0.4.21 (2013-07-03)
-------------------
* check for CATKIN_ENABLE_TESTING to enable configure without tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants