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

Autoware CUDA build failed, required packages error about colcon, invalid syntax

asked 2021-06-25 12:21:10 -0500

fangzhou gravatar image

updated 2021-07-01 17:40:53 -0500

Hi, I am using Ubuntu 16.04. I was trying to build the docker image of autoware.ai using CUDA and colcon, but got errors about exception loading extension related to colcon. My environment:

  • Ubuntu 16.04
  • CUDA 10

I have tried different versions of Autoware.ai from 1.12.0 to the latest master branch, no one is working.

Below is part of the error log. The errors keep repeating for building each package:

13:13:48 dev@lambda-quad ~/autoware.ai $ AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
ERROR:colcon.colcon_core.entry_point:Exception loading extension 'colcon_core.task.build.python': invalid syntax (dist.py, line 585)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/colcon_core/entry_point.py", line 120, in load_entry_points
    extension_type = load_entry_point(entry_point)
  File "/usr/lib/python3/dist-packages/colcon_core/entry_point.py", line 168, in load_entry_point
    return entry_point.load()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2450, in load
    return self.resolve()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2456, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/colcon_core/task/python/build.py", line 8, in <module>
    import setuptools  # noqa: F401
  File "/usr/local/lib/python3.5/dist-packages/setuptools/__init__.py", line 18, in <module>
    from setuptools.dist import Distribution
  File "/usr/local/lib/python3.5/dist-packages/setuptools/dist.py", line 585
    license_files: Optional[List[str]] = self.metadata.license_files
                 ^
SyntaxError: invalid syntax

ERROR:colcon.colcon_core.entry_point:Exception loading extension 'colcon_core.task.build.ros.ament_python': invalid syntax (dist.py, line 585)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/colcon_core/entry_point.py", line 120, in load_entry_points
    extension_type = load_entry_point(entry_point)
  File "/usr/lib/python3/dist-packages/colcon_core/entry_point.py", line 168, in load_entry_point
    return entry_point.load()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2450, in load
    return self.resolve()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2456, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/colcon_ros/task/ament_python/build.py", line 17, in <module>
    from colcon_core.task.python.build import PythonBuildTask
  File "/usr/lib/python3/dist-packages/colcon_core/task/python/build.py", line 8, in <module>
    import setuptools  # noqa: F401
  File "/usr/local/lib/python3.5/dist-packages/setuptools/__init__.py", line 18, in <module>
    from setuptools.dist import Distribution
  File "/usr/local/lib/python3.5/dist-packages/setuptools/dist.py", line 585
    license_files: Optional[List[str]] = self.metadata.license_files
                 ^
SyntaxError: invalid syntax

[0.132s] ERROR:colcon.colcon_core.entry_point:Exception loading extension 'colcon_core.package_identification.python_setup_py': invalid syntax (dist.py, line 585)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/colcon_core/entry_point.py", line 120, in load_entry_points
    extension_type = load_entry_point(entry_point)
  File "/usr/lib/python3/dist-packages/colcon_core/entry_point.py", line 168, in load_entry_point
    return entry_point.load()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2450, in load
    return self.resolve()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2456, in resolve
    module = __import__(self.module_name, fromlist ...
(more)
edit retag flag offensive close merge delete

Comments

It looks like you might have an older version of Python. It's complaining about type annotation, which is only supported from Python 3.5+. The traceback shows /usr/local/lib/python3.5/, so it would be weird if you didn't actually have Python 3.5, but I don't see any other explanation for that error. If you could provide all the commands you ran, the tutorial you followed, etc., we might be able to help.

christophebedard gravatar image christophebedard  ( 2021-06-28 15:48:15 -0500 )edit

If you can, maybe try to modify any command you run/dockerfile you build to add the --include-eol-distros option for rosdep update. Kinetic is EOL, and it could cause some problems as you say, but this error seems unrelated.

christophebedard gravatar image christophebedard  ( 2021-06-28 15:56:12 -0500 )edit

@christophebedard I have updated details of my question and the errors. I have python 3.5 installed. --include-eol-distros has been added before the build. I am not sure why this error happened. All I guess maybe related to the recent ROS Kinetic EOL.

fangzhou gravatar image fangzhou  ( 2021-07-01 17:43:45 -0500 )edit

If you could provide all the commands you ran, the tutorial you followed, etc., we might be able to help, otherwise it's quite hard. How did you install colcon? Has colcon ever worked before on this machine/setup? Also, you say you're trying to build a dockerfile, but this looks like straight command-line.

christophebedard gravatar image christophebedard  ( 2021-07-02 11:12:21 -0500 )edit
1

@christophebedard Thanks for the reply. The tutorial I followed is https://github.com/Autoware-AI/autoware.ai/wiki/Source-Build. I am using Ubuntu 16.04 and CUDA 10. The only difference is I use rosdep update --include-eol-distros for the ros update.

I was trying to build a docker image of a project based on Autoware, but got the build error. So I switched to build the Autoware.ai to see if it works, then I got the same build error.

I was able to build the Autoware.ai about 3 months ago. I use the same the same desktop and environment.

fangzhou gravatar image fangzhou  ( 2021-07-02 12:16:03 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-07-02 18:16:12 -0500

I was able to reproduce by following the tutorial (https://github.com/Autoware-AI/autowa...).

I don't know why exactly, but it seems that the last version of setuptools that is compatible with Python 3.5 (which is what we have on Ubuntu 16.04) is 51.3.3. However, by default with the pip3 install -U setuptools command (from the tutorial), we get version 57.0.0. The solution should therefore be to uninstall it and install 51.3.3:

pip3 uninstall setuptools && pip3 install setuptools==51.3.3

See this GitHub issue: https://github.com/pypa/setuptools/is.... This fixes the SyntaxError with colcon build for me, but I haven't done any other validation.

Here are all the commands I ran, including the solution at the end: https://gist.github.com/christophebed...

edit flag offensive delete link more

Comments

1

Thanks! I use "pip3 install setuptools==51.3.3" instead of "pip3 install -U setuptools" and it works. There are still some packages that cannot be built. But they belongs to different issues. Appreciate!

fangzhou gravatar image fangzhou  ( 2021-07-06 13:09:16 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2021-06-25 12:21:10 -0500

Seen: 687 times

Last updated: Jul 02 '21