cannot run catkin build on ubuntu 20.04

1.7k Views Asked by At

I have Ubuntu 20.04 and I've just installed ROS noetic and catkin.

But each time I do catkin build and I have a list of errors and cannot proceed. Can you guys please help me solve this problem.

Traceback (most recent call last):
  File "/usr/local/bin/catkin", line 5, in <module>
    from catkin_tools.commands.catkin import main
  File "/usr/local/lib/python3.8/dist-packages/catkin_tools/commands/catkin.py", line 28, in <module>
    from catkin_tools.common import is_tty
  File "/usr/local/lib/python3.8/dist-packages/catkin_tools/common.py", line 23, in <module>
    import trollius as asyncio
  File "/usr/local/lib/python3.8/dist-packages/trollius/__init__.py", line 21, in <module>
    from .base_events import *
  File "/usr/local/lib/python3.8/dist-packages/trollius/base_events.py", line 42, in <module>
    from . import tasks
  File "/usr/local/lib/python3.8/dist-packages/trollius/tasks.py", line 565
    def async(coro_or_future, loop=None):
        ^
SyntaxError: invalid syntax
2

There are 2 best solutions below

0
On BEST ANSWER

apt and pip3 versions of catkin_tools are broken for noetic. Workaround is to install like this:

sudo pip3 install git+https://github.com/catkin/catkin_tools.git

Refer to; https://github.com/Rayman/ros-get/issues/95

1
On

sudo apt install catkin Reading package lists... Done Building dependency tree
Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: python3-rosdep-modules : Depends: python3-catkin-pkg-modules (>= 0.4.0) but it is not going to be installed python3-rosdistro-modules : Depends: python3-catkin-pkg-modules but it is not going to be installed python3-rospkg-modules : Depends: python3-catkin-pkg-modules but it is not going to be installed ros-noetic-rospack : Depends: python3-catkin-pkg-modules but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).