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

rosinstall on ubuntu 11.04

asked 2012-10-29 06:51:54 -0500

zoltan gravatar image

updated 2014-01-28 17:14:06 -0500

ngrennan gravatar image

Hi!

I am trying to install ROS on Ubuntu 11.04. I tried to follow howtos and similar documents, but it didn't work for me. My main goal is to get a working system with MORSE, ROS and Blender. I managed to install Blender and MORSE, they work together. I also installed python 3.2.1 and ROS electric from the repositories. Now, when I try to run roscore or roslaunch I get the following errors:

Traceback (most recent call last):
  File "/opt/ros/electric/ros/bin/roslaunch", line 2, in <module>
    from ros import roslaunch
ImportError: cannot import name roslaunch

I thought that it is maybe because I hadn't yet installed the rosinstall software. So I tried to install it from the repositories using sudo apt-get install python-rosinstall as it was written here: http://www.ros.org/doc/api/rosinstall/html/ Unfortunately, it seems to only work for fuerte not for electric, so I tried to install it using pip:

sudo pip install -U rosinstall vcstools

Then I try to run rosinstall, but I always get errors like this:

    Traceback (most recent call last):
  File "/home/zsarosi/.local/bin/rosinstall", line 5, in <module>
    from rosinstall.rosinstall_cli import rosinstall_main
  File "/home/zsarosi/.local/lib/python2.7/site-packages/rosinstall/__init__.py", line 33, in <module>
    import rosinstall.helpers
  File "/home/zsarosi/.local/lib/python2.7/site-packages/rosinstall/helpers.py", line 35, in <module>
    from rosinstall.config_elements import SetupConfigElement
  File "/home/zsarosi/.local/lib/python2.7/site-packages/rosinstall/config_elements.py", line 38, in <module>
    from vcstools import VcsClient
  File "/home/zsarosi/.local/lib/python2.7/site-packages/vcstools/__init__.py", line 45, in <module>
    from vcstools.tar import TarClient
  File "/home/zsarosi/.local/lib/python2.7/site-packages/vcstools/tar.py", line 52, in <module>
    import yaml
  File "/usr/local/lib/python3.2/dist-packages/yaml/__init__.py", line 284
    class YAMLObject(metaclass=YAMLObjectMetaclass):
                              ^
SyntaxError: invalid syntax

Since it shows directories with the version 2.7 in them instead of 3.2, I suspect that my PYTHONPATH environmental variable is still missing something, at the moment it looks like this:

/opt/morse/lib/python3/site-packages:/opt/ros/electric/ros/core/roslib/src::/usr/local/lib/python3.2:/usr/local/lib/python3.2/site-packages:/usr/local/lib/python3.2/dist-packages:/home/zsarosi/builds/morse/bindings/pymorse:/opt/morse/lib/python3/dist-packages:/opt/ros/electric/ros/core/roslib/src

I am stucked now. Can anyone please help me?

edit retag flag offensive close merge delete

Comments

Do you need python 3.2?Try install python2.7?

Po-Jen Lai gravatar image Po-Jen Lai  ( 2012-10-29 07:13:21 -0500 )edit

Blender needs python 3 and making morse work with ros is definitely non-trivial.

Lorenz gravatar image Lorenz  ( 2012-10-29 07:14:21 -0500 )edit

Sorry for the incorrect comment.

Po-Jen Lai gravatar image Po-Jen Lai  ( 2012-10-29 07:16:54 -0500 )edit

4 Answers

Sort by ยป oldest newest most voted
3

answered 2012-10-30 00:10:17 -0500

KruseT gravatar image

updated 2012-10-30 02:42:56 -0500

First, rosinstall is only a tool to download sources from version control. It makes life easier when you want to download sources, and that's all. So it will not solve your earlier problem.

Traceback (most recent call last):
  File "/opt/ros/electric/ros/bin/roslaunch", line 2, in <module>
    from ros import roslaunch
ImportError: cannot import name roslaunch

This means your the roslaunch python libraries are not on your PYTHONPATH. To get them on your pythonpath, it is usually sufficient to run:

source /opt/ros/electric/setup.bash

before attempting to run roscore or any ros node or tool. Since your questio ndoes not show what exactly you have tried to run when getting the error message, we can only guess what went wrong.

As to rosinstall, we have not finalized python3 compatibility. So it might be best for you to not use it for now, unless you manage to run it using python2. getting that to run might be good for a different question.

(One way to run cleanly things using python2 in Ubuntu is to use virtualenv.

Note that apparently you are running rosinstall using python2.7, therefore when it tires to use yaml for python3, you get the invalid syntax error. So what you would need is to create a virtualenv for python2.7, install yaml using pip to that virtualenv, then using that virtualenv run rosinstall. Then rosinstall would not use python3 yaml, but python2 yaml from your environment. Note that for this approach, you would probably also have to install other python libraries for python2.7.)

edit flag offensive delete link more
1

answered 2012-10-31 02:15:15 -0500

zoltan gravatar image

Thanks KruseT for the answer. In the meantime I have managed to come up with a simple PYHTONPATH that works with ros and morse too.

/opt/ros/electric/ros/core/roslib/src:/opt/morse/lib/python3/dist-packages

In my .bashrc file I have the following regarding morse and ROS:

source /opt/ros/electric/setup.bash
export PYTHONPATH=$PYTHONPATH:$ROS_ROOT/core/roslib/src

#   
# MORSE Setup
#
export MORSE_ROOT=/opt/morse
export PATH=/opt/morse/bin:${PATH}
export MORSE_BLENDER=/opt/blender/bin/blender
#export PYTHONPATH=/opt/morse/lib/python3/site-packages:${PYTHONPATH}

export PYTHONPATH=$PYTHONPATH:/opt/morse/lib/python3/dist-packages
source /home/myuser/electric_workspace/setup.bash

Now it seems to work:

  • I can run roscore and roslaunch without any errors
  • I can run rosinstall without any error message
  • I can run morse check

However, I don't know yet, whether it works with other software, I haven't fully tested it.

edit flag offensive delete link more
0

answered 2012-11-28 00:51:52 -0500

flier gravatar image

I have written an extensive tutorial on that topic. It's way to long to post it right here so you may have a look at:

warp1337.com/content/morse-and-ros-detailed-installation-howto-ubuntu-precise

Cheers, Florian

edit flag offensive delete link more

Comments

Hi Florian, I am just checking your site, looks very cool! Thanks! I am going to try your howto and read the other stuff too. Best, Zoltan

zoltan gravatar image zoltan  ( 2012-12-14 09:26:26 -0500 )edit
0

answered 2013-12-19 01:05:12 -0500

Ruthven gravatar image

updated 2013-12-19 01:05:59 -0500

I found an alternative solution. The problem here is that (Python3) yaml is called from a Python2.7 script, with evident incompatibilities.

I thus installed yaml in its Python2.7 version:

 python2.7 setup.py install --prefix=/opt/ros/electric

and then added the path where it has been installed in PYTHONPATH, which in my case was something like:

export PYTHONPATH=$PYTHONPATH:/opt/ros/electric/lib/python2.7/site-packages
edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-10-29 06:51:54 -0500

Seen: 2,429 times

Last updated: Dec 19 '13