1
$\begingroup$

I am trying to build the example repository of ROS 2 Humble according to the tutorial. But the command colcon build --symlink-install gives the following error for all python packages. I am on Ubuntu 22.04.

What could be the reason for that?

Failed   <<< examples_rclpy_pointcloud_publisher [0.86s, exited with code 1]
    --- stderr: launch_testing_examples
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/colcon_core/executor/__init__.py", line 91, in __call__
        rc = await self.task(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/colcon_core/task/__init__.py", line 93, in __call__
        return await task_method(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/colcon_ros/task/ament_python/build.py", line 51, in build
        setup_py_data = get_setup_data(self.context.pkg, env)
      File "/usr/lib/python3/dist-packages/colcon_core/task/python/__init__.py", line 20, in get_setup_data
        return dict(pkg.metadata[key](env))
      File "/usr/lib/python3/dist-packages/colcon_ros/package_augmentation/ros_ament_python.py", line 57, in getter
        return get_setup_information(
      File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 241, in get_setup_information
        _setup_information_cache[hashable_env] = _get_setup_information(
      File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 293, in _get_setup_information
        return ast.literal_eval(output)
      File "/usr/lib/python3.10/ast.py", line 64, in literal_eval
        node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
      File "/usr/lib/python3.10/ast.py", line 50, in parse
        return compile(source, filename, mode, flags,
      File "<unknown>", line 1
        {'package_data': {}, 'dist_files': [], 'src_root': None, 'dependency_links': [], 'setup_requires': [], 'eager_resources': None, 'entry_points': {'console_scripts': []}, 'exclude_package_data': None, 'extras_require': {}, 'include_package_data': None, 'install_requires': ['setuptools'], 'namespace_packages': None, 'packages': ['launch_testing_examples'], 'python_requires': None, 'test_loader': None, 'test_runner': None, 'test_suite': None, 'tests_require': ['pytest'], 'use_2to3': None, 'zip_safe': True, 'verbose': 1, 'dry_run': 0, 'help': 0, 'command_packages': None, 'script_name': 'setup.py', 'script_args': ['--dry-run'], 'command_options': {'develop': {'script_dir': ('setup.cfg', '$base/lib/launch_testing_examples')}, 'install': {'install_scripts': ('setup.cfg', '$base/lib/launch_testing_examples')}}, 'package_dir': {}, 'py_modules': None, 'libraries': None, 'headers': None, 'ext_package': None, 'include_dirs': None, 'extra_path': None, 'scripts': None, 'data_files': [('share/ament_index/resource_index/packages', ['resource/launch_testing_examples']), ('share/launch_testing_examples', ['package.xml'])], 'password': '', 'command_obj': {}, 'have_run': {}, 'want_user_cfg': True, 'metadata': {'name': 'launch_testing_examples', 'version': '0.15.1', 'author': None, 'author_email': None, 'maintainer': 'Aditya Pande, Shane Loretz', 'maintainer_email': '[email protected], [email protected]', 'url': None, 'license': 'Apache License 2.0', 'description': 'Examples of simple launch tests', 'long_description': None, 'keywords': None, 'platforms': None, 'classifiers': None, 'download_url': None, 'provides': None, 'requires': None, 'obsoletes': None, 'long_description_content_type': None, 'project_urls': {}, 'license_file': None, '_normalized_install_requires': {'setuptools': <Requirement('setuptools')>}, '_normalized_extras_require': {}}}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ^
    SyntaxError: invalid syntax

I reinstalled ROS 2 but it did not resolve the problem. What else could I try?

$\endgroup$
0

1 Answer 1

1
$\begingroup$

This appears to be a recent break with a particular version of setuptools which has been reported in pypa/setuptools#4046 and colcon/colcon-python-setup-py#56.

A working mitigation is to upgrade the setuptools version in the ROS2 shell to >68.2.0 with the following command:

# replace iron with your installed version of ROS2
source /opt/ros/iron/local_setup.bash
python3 -m pip install -U setuptools>68.2.0

After this, you should be able to build.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks that worked! $\endgroup$
    – aladin6060
    Commented Sep 12, 2023 at 15:33

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.