0
$\begingroup$

Rosanswers logo

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_virtualenv__ubuntu_bionic_amd64/26/console

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

Thank you!


Originally posted by max-krichenbauer on ROS Answers with karma: 17 on 2019-12-24

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by marguedas with karma: 3606 on 2019-12-24

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by max-krichenbauer on 2019-12-24:
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?

Comment by tfoote on 2019-12-24:
That sounds like the key does not exist as predicted above in the answer. With links how to resolve it.

Comment by max-krichenbauer on 2019-12-24:
I looked on index.ros.org and it seems there is no python3-packaging: https://index.ros.org/search/?term=packaging&section=deps

Comment by max-krichenbauer on 2019-12-24:
Thanks @tfoote Sorry, but I don't understand what you mean with "With links how to resolve it."?

Comment by gvdhoorn on 2019-12-24:
@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.

Comment by marguedas on 2019-12-24:
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

Comment by max-krichenbauer on 2019-12-24:
Thank you, now I understood. I'll try to get the key added.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.