0
$\begingroup$

Rosanswers logo

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_tools.git

$ 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.egg-info/entry_points.txt
reading manifest file 'catkin_tools.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'catkin_tools.egg-info/SOURCES.txt'
removing '/usr/local/lib/python2.7/dist-packages/catkin_tools-0.4.5-py2.7.egg-info' (and everything under it)
Copying catkin_tools.egg-info to /usr/local/lib/python2.7/dist-packages/catkin_tools-0.4.5-py2.7.egg-info
running install_scripts
Installing catkin script to /usr/local/bin
writing list of installed files to 'install_manifest.txt'

Changing permissions of /usr/local/lib/python2.7/dist-packages/catkin_tools/ .... I am not posting these permissions as they are too big.. Example of these changing permissions (I am posting one of the lines):

changing permissions of /usr/local/lib/python2.7/dist-packages/catkin_tools/spaces/__init__.pyc to 644

Then after these changes, I get this error:

error: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist- 
packages/catkin_tools/execution/executor.pyc'

Originally posted by TheRoot on ROS Answers with karma: 41 on 2020-06-02

Post score: 4


Original comments

Comment by Procópio on 2020-06-02:
post your code, please

Comment by TheRoot on 2020-06-02:
I have posted what I have done @Procópio

Comment by gvdhoorn on 2020-06-03:\

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?

Comment by TheRoot on 2020-06-03:
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

Comment by gvdhoorn on 2020-06-03:\

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.

Comment by TheRoot on 2020-06-03:
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

Comment by gvdhoorn on 2020-06-03:\

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 me. No tracebacks.

At this point, assuming you have a standard Bionic & Melodic installation, catkin_tools should still work on Bionic.

Comment by JustinBlack02 on 2020-06-03:
@gvdhoorn, interesting, I'm not getting the same results even after pulling the latest docker image.

Comment by gvdhoorn on 2020-06-04:
If you can show us the exact commands you used, that would be interesting.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The master branch doesn't support Python 2 anymore.

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


Originally posted by Dirk Thomas with karma: 16276 on 2020-06-03

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by gvdhoorn on 2020-06-04:
Isn't the real question here why the OP doesn't use sudo apt install python-catkin-tools on Melodic?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.