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

commands of catkin tools giving errors

asked 2020-06-02 16:18:44 -0500

TheRoot gravatar image

updated 2020-06-03 02:38:58 -0500

Recently I installed catkin tools. I have ros (melodic) installed on my system (Ubuntu 18.04). The problem is that I can use catkin_init_workspace, but not catkin init. Using catkin_init or any of the commands of catkin tools gives me an error that asyncio is missing. So I installed asyncio using pip, but now I am getting this error:

Traceback (most recent call last):
File "/home/comp/.local/bin/catkin", line 11, in <module>
load_entry_point('catkin-tools==0.4.5', 'console_scripts', 'catkin')()
File "/home/comp/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/comp/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
return ep.load()
File "/home/comp/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2443, in load
return self.resolve()
File "/home/comp/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2449, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/home/comp/.local/lib/python2.7/site-packages/catkin_tools/commands/catkin.py", line 28, in <module>
from catkin_tools.common import is_tty
File "/home/comp/.local/lib/python2.7/site-packages/catkin_tools/common.py", line 24, in <module>
import asyncio
File "/home/comp/.local/lib/python2.7/site-packages/asyncio/__init__.py", line 9, in <module>
from . import selectors
File "/home/comp/.local/lib/python2.7/site-packages/asyncio/selectors.py", line 39
"{!r}".format(fileobj)) from None
                           ^
SyntaxError: invalid syntax

Any help is appreciated!

EDIT :

I just made a directory with a src directory in it and ran :

catkin init

I get the above error. However catkin_init_workspace worked fine. If needed, these are the instructions I followed to install catkin tools -

https://catkin-tools.readthedocs.io/en/latest/installing.html

This is how I installed catkin tools -

$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu lsb_release -sc main" > /etc/apt/sources.list.d/ros-latest.list'

$ wget http://packages.ros.org/ros.key -O - | sudo apt-key add -

$ sudo apt-get update

$ sudo apt-get install python-catkin-tools

This is the command I used to install asyncio:

pip install asyncio

EDIT 2:

I tried to install catkin tools from source (from the same website as earlier). I am still getting syntax errors, but different ones...

Commands I used:

$ git clone https://github.com/catkin/catkin_tool...

$ cd catkin_tools

$ pip install -r requirements.txt --upgrade

$ sudo python setup.py install --record install_manifest.txt

The first three commands work fine, the fourth one (sudo python setup.py install ...) gives these errors:

sudo python setup.py install --record install_manifest.txt
running install
running build
running build_py
running install_lib
byte-compiling /usr/local/lib/python2.7/dist-packages/catkin_tools/execution/executor.py to executor.pyc
File "/usr/local/lib/python2.7/dist-packages/catkin_tools/execution/executor.py", line 73
yield from lock
         ^
SyntaxError: invalid syntax

running install_data
running install_egg_info
running egg_info
writing requirements to catkin_tools.egg-info/requires.txt
writing catkin_tools.egg-info/PKG-INFO
writing top-level names to catkin_tools.egg-info/top_level.txt
writing dependency_links to catkin_tools.egg-info/dependency_links.txt
writing entry points to catkin_tools ...
(more)
edit retag flag offensive close merge delete

Comments

post your code, please

Procópio gravatar image Procópio  ( 2020-06-02 16:44:05 -0500 )edit

I have posted what I have done @Procópio

TheRoot gravatar image TheRoot  ( 2020-06-02 23:39:18 -0500 )edit
File "/home/comp/.local/bin/catkin"

how did you install catkin_tools? The file path in your traceback suggests you used pip.

Could you explain why you used pip?

gvdhoorn gravatar image gvdhoorn  ( 2020-06-03 02:09:55 -0500 )edit

So, I have updated exactly how I installed catkin tools...I don't think if I have used pip...please pardon me as I am a beginner..@gvdhoorn

TheRoot gravatar image TheRoot  ( 2020-06-03 02:20:24 -0500 )edit

I have ros (melodic) installed on my system (Ubuntu 18.04).

Assuming you are using the system Python 2.x, why don't you use:

sudo apt install python-catkin-tools?

I would recommend to clean up the mess created by sudo python setup.py install (ie: uninstall it).

If you must install things from sources, use pip to do it, so you have an easy way to uninstall.

And you still haven't told us why you installed things from source.

gvdhoorn gravatar image gvdhoorn  ( 2020-06-03 02:56:16 -0500 )edit

It said that catkin tools was in beta...so I thought installing it from source might resolve the issue for me...I ran sudo apt-get remove python setup.py and installed catkin tools using sudo apt install python-catkin-tools .... but still I am getting this issue @gvdhoorn

TheRoot gravatar image TheRoot  ( 2020-06-03 03:21:46 -0500 )edit

It said that catkin tools was in beta...so I thought installing it from source might resolve the issue for me

I would strongly recommend to avoid building things from source, unless you have an absolute necessity.

Also: if you do, use tools which isolate these source builds (ie: don't run sudo [..] install), because that will contaminate your system with all sorts of files, and you don't know where they go.

but still I am getting this issue

Did you clean out everything which was installed as part of your initial attempts from /usr/local? Those paths also appear in the traceback you show. You'll have to clean all that up. And /home/comp/.local.

I've just ran docker run -ti --rm ros:melodic and then apt update && apt install python-catkin-tools. Invoking catkin (ie: the base command) or catkin config on a workspace works for ...(more)

gvdhoorn gravatar image gvdhoorn  ( 2020-06-03 03:26:35 -0500 )edit

@gvdhoorn, interesting, I'm not getting the same results even after pulling the latest docker image.

JustinBlack02 gravatar image JustinBlack02  ( 2020-06-03 17:07:36 -0500 )edit

3 Answers

Sort by » oldest newest most voted
2

answered 2020-06-03 16:49:13 -0500

Dirk Thomas gravatar image

The master branch doesn't support Python 2 anymore.

For Python 2 compatible code you should use the 0.6.x branch.

edit flag offensive delete link more

Comments

Isn't the real question here why the OP doesn't use sudo apt install python-catkin-tools on Melodic?

gvdhoorn gravatar image gvdhoorn  ( 2020-06-04 01:48:27 -0500 )edit
0

answered 2021-06-30 18:13:58 -0500

Vico gravatar image

I had the same problem and I tried sudo apt-get install python3-pip instead of sudo apt-get install python-pip that fixed the problem of using python2 pip when doing sudo python setup.py install --record install_manifest.txt Hope this helps!

edit flag offensive delete link more
-1

answered 2020-06-03 02:02:15 -0500

KenYN gravatar image

This seems to be the same issue - newer versions of asyncio don't work on Python 2.7.

edit flag offensive delete link more

Comments

1

Yeah, that seems to be the same one....but now what should I do? Is there a way around it? I cannot do without catkin tools....further, some other devices with ubuntu don't seem to have this issue..@KenYN

TheRoot gravatar image TheRoot  ( 2020-06-03 02:10:25 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-06-02 16:18:44 -0500

Seen: 1,887 times

Last updated: Jun 03 '20