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

How do I include the Python "packaging" library on build farm?

asked 2019-12-24 00:23:54 -0500

max-krichenbauer gravatar image

Hello!

I'm confused how to properly include a requirement for the Python packaging library into my package.

As far as I understand, that library is called python-packaging in ROS, so I added it to my package.xml. On my local system, it builds and runs without problems, but on the build farm, it fails with

05:55:04 Traceback (most recent call last):
05:55:04   File "/tmp/ws/install_isolated/ament_virtualenv/lib/python3.6/site-packages/ament_virtualenv/combine_requirements.py", line 30, in <module>
05:55:04     from packaging.requirements import Requirement, InvalidRequirement
05:55:04 ModuleNotFoundError: No module named 'packaging'

and

05:55:05 [1.060s]   File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 786, in resolve
05:55:05 [1.061s]     raise DistributionNotFound(req, requirers)
05:55:05 [1.061s] pkg_resources.DistributionNotFound: The 'packaging' distribution was not found and is required by ament-virtualenv

I've tried all forms of dependencies (build_depend, buildtool_depend, exec_depend, ...), and tried adding either packaging or python-packaging to the install_requires section in setup.py / setup.cgf.

Can someone please let me know the proper way to include packaging (the Python library) so that it'll build on the build farm as well?

Here is the build farm log for reference: http://build.ros2.org/job/Cdev__ament...

and the source code repository: https://github.com/esol-community/ame...

Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-12-24 02:08:23 -0500

marguedas gravatar image

ROS 2 is targeting Python3 only. python-packaging refers to the Python 2 package. The rosdep key should be python3-packaging (the same applies to all python-* dependencies in you package.xml.

If the key doesn't exist in rosdep, you can contribute it following these instructions

HTH

edit flag offensive delete link more

Comments

Thank you for your answer @marguedas ! I changed it, but now I'm getting KeyError: 'python3-packaging' and RuntimeError: Could not resolve the rosdep key 'python3-packaging'. Any ideas why?

max-krichenbauer gravatar image max-krichenbauer  ( 2019-12-24 03:01:10 -0500 )edit

That sounds like the key does not exist as predicted above in the answer. With links how to resolve it.

tfoote gravatar image tfoote  ( 2019-12-24 03:03:12 -0500 )edit

I looked on index.ros.org and it seems there is no python3-packaging: https://index.ros.org/search/?term=pa...

max-krichenbauer gravatar image max-krichenbauer  ( 2019-12-24 03:07:07 -0500 )edit

Thanks @tfoote Sorry, but I don't understand what you mean with "With links how to resolve it."?

max-krichenbauer gravatar image max-krichenbauer  ( 2019-12-24 03:09:52 -0500 )edit

@tfoote referred to these lines in the linked documentation:

For convenience in reviewing, please comment in the PR with links to the web listings of packages such as on http://packages.ubuntu.com, http://packages.debian.org, and https://apps.fedoraproject.org/packages or if a pip package pypi.python.org.

gvdhoorn gravatar image gvdhoorn  ( 2019-12-24 03:28:38 -0500 )edit

As @tfoote mentioned, the rosdep key for python3-packaging doesn't exist yet. In my answer I provided links to the instructions to how to contribute new rosdep rules. You should follow them and contribute a new rule python3-packaging

marguedas gravatar image marguedas  ( 2019-12-24 03:51:44 -0500 )edit

Thank you, now I understood. I'll try to get the key added.

max-krichenbauer gravatar image max-krichenbauer  ( 2019-12-24 04:40:54 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-12-24 00:23:54 -0500

Seen: 586 times

Last updated: Dec 24 '19