我将
Ubuntu 22.04
与 ros2-humble
一起使用,并在构建工作区时出现以下错误
我尝试了 colcon build
和 colcon build --symlink-install
我在另一台计算机上构建了相同的 turtlebot3_msgs
,工作正常。
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]
我最近遇到了类似的问题,因为您的环境中安装了
setuptools
版本以及 turtlebot3_msgs
包的构建系统。具体来说,您的 canonicalize_version
版本中的 setuptools
函数不支持 strip_trailing_zero
参数。
升级
setuptools
到最新版本:
运行以下命令来更新setuptools
:
pip install --upgrade setuptools
清除构建和重建:
rm -rf ~/tb3_msgs/build/turtlebot3_msgs
colcon build --packages-select turtlebot3_msgs
重建后,验证包是否构建成功:)