skip to Main Content

I am using Ubuntu 22.04 with ros2-humble and got the following error while building the workspace
I tried colcon build and colcon build --symlink-install I build same turtlebot3_msgs on another computer package working correctly.

Starting >>> turtlebot3_msgs
--- stderr: turtlebot3_msgs                             
Traceback (most recent call last):
  File "/home/mubashir/tb3_msgs/build/turtlebot3_msgs/ament_cmake_python/turtlebot3_msgs/setup.py", line 4, in <module>
    setup(
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/__init__.py", line 117, in setup
    return distutils.core.setup(**attrs)
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 183, in setup
    return run_commands(dist)
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 199, in run_commands
    dist.run_commands()
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands
    self.run_command(cmd)
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/dist.py", line 994, in run_command
    super().run_command(command)
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
    cmd_obj.run()
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 312, in run
    self.find_sources()
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 320, in find_sources
    mm.run()
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 548, in run
    self.prune_file_list()
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/command/sdist.py", line 162, in prune_file_list
    super().prune_file_list()
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/_distutils/command/sdist.py", line 380, in prune_file_list
    base_dir = self.distribution.get_fullname()
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/_core_metadata.py", line 267, in get_fullname
    return _distribution_fullname(self.get_name(), self.get_version())
  File "/home/mubashir/.local/lib/python3.10/site-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname
    canonicalize_version(version, strip_trailing_zero=False),
TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'
gmake[2]: *** [CMakeFiles/ament_cmake_python_build_turtlebot3_msgs_egg.dir/build.make:70: CMakeFiles/ament_cmake_python_build_turtlebot3_msgs_egg] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:447: CMakeFiles/ament_cmake_python_build_turtlebot3_msgs_egg.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< turtlebot3_msgs [8.55s, exited with code 2]

Summary: 0 packages finished [8.72s]

2

Answers


  1. I had a similar issue recently due to the setuptools version installed in your environment and the turtlebot3_msgs package’s build system. Specifically, the canonicalize_version function in your version of setuptools does not support the strip_trailing_zero argument.

    Resolution Steps

    1. Upgrade setuptools to the Latest Version:
      Run the following command to update setuptools:

      pip install --upgrade setuptools
      
    2. Clear Build and Rebuild:

      rm -rf ~/tb3_msgs/build/turtlebot3_msgs
      colcon build --packages-select turtlebot3_msgs
      

    After rebuilding, verify that the package was built successfully:)

    Login or Signup to reply.
  2. in my case the issue was caused by a newer version of setuptools.

    It was fixed by simply downgrading:

    pip install setuptools==68

    also found the answer here: https://kb.databricks.com/libraries/virtualenv-creation-failure-due-to-setuptools-=-7100-

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search