ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Cannot run roscore, rosmake with python 3

asked 2011-04-20 22:17:36 -0600

Tien Thanh gravatar image

updated 2011-04-21 14:48:07 -0600

joq gravatar image

Hi all,

I got SyntaxError when run roscore, rosmake, rosversion ...

tienthanh@tienthanh-pc:~$ roscore
Traceback (most recent call last):
 File "/opt/ros/diamondback/ros/bin/roscore", line 34, in <module>
    from ros import roslaunch
  File "/opt/ros/diamondback/ros/core/roslib/src/ros/", line 55
    except roslib.packages.InvalidROSPkgException, e:
SyntaxError: invalid syntax

tienthanh@tienthanh-pc:~$ roscd rgbdslam && rosmake --rosdep-install rgbdslam
  File "/opt/ros/diamondback/ros/bin/rosmake", line 46
    print "Rospack failed to build" 
tienthanh@tienthanh-pc:/opt/ros/diamondback/stacks/rgbdslam$ rosversion
  File "/opt/ros/diamondback/ros/bin/rosversion", line 55
    except Exception, e:
SyntaxError: invalid syntax
edit retag flag offensive close merge delete


Which version of python are you running?
Ugo gravatar image Ugo  ( 2011-04-20 22:24:22 -0600 )edit
python --version Python 3.1.2
Tien Thanh gravatar image Tien Thanh  ( 2011-04-21 00:16:34 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2011-04-21 00:22:20 -0600

Ugo gravatar image

For python 3 support, you should have a look at this ticket:

But I think you're going to have some trouble getting ROS to work on python 3. Can't you use python2 instead? Or are you running Arch Linux?



edit flag offensive delete link more


I use Ubuntu 10.04, I tried to change the python default version to 2.6 with sudo ln -s /usr/bin/python-config2.6 /usr/bin/python-config and sudo ln -s /usr/bin/python2.6 /usr/bin/python. But it's not work. I also tried with update-alternatives, but that no help. How to change back to python2.6?
Tien Thanh gravatar image Tien Thanh  ( 2011-04-21 01:07:23 -0600 )edit
You ran update-alternatives and selected python 2.6? What does python --version return?
Ugo gravatar image Ugo  ( 2011-04-21 01:38:55 -0600 )edit
Python 3.1.2
Tien Thanh gravatar image Tien Thanh  ( 2011-04-21 02:06:10 -0600 )edit
and ls -l /usr/bin/python is linked to /usr/bin/python2.6? How did you install python3? Through apt-get?
Ugo gravatar image Ugo  ( 2011-04-21 02:12:36 -0600 )edit
Yes the ln -s /usr/bin/python is linked to /usr/bin/python2.6. I installed python3 through robotpkg
Tien Thanh gravatar image Tien Thanh  ( 2011-04-21 02:28:38 -0600 )edit
Then you should probably have a look at your PATH and see where python 3 is installed (may be /usr/local/bin?). If you do export PATH=/usr/bin and check python --version it should give you python 2.6.
Ugo gravatar image Ugo  ( 2011-04-21 02:34:42 -0600 )edit
I change the link in python in robotpkg to /usr/bin/python2.6 and it works. But I'm not sure package in robotpkg still work probaly. Thank you anyways.
Tien Thanh gravatar image Tien Thanh  ( 2011-04-21 03:07:26 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-04-20 22:17:36 -0600

Seen: 1,522 times

Last updated: Apr 21 '11