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

Using fuerte with python 3

asked 2012-04-24 22:02:22 -0600

languitar gravatar image

updated 2014-01-28 17:12:05 -0600

ngrennan gravatar image

I have seen that several issues regarding python 3 support have been solved recently, e.g. [1]. However, I could not find any information how to actually use the new release with python 3? That means how do I get the python libraries compiled and installed in a python3-compatible pythonpath etc.?


Ok, trying michikarg's suggestion I end up in this error:

>>> import roslib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/vol/corcse/ros-fuerte/x86_64/src/ros-underlay/ros/core/roslib/src/roslib/", line 50, in <module>
    from roslib.launcher import load_manifest
  File "/vol/corcse/ros-fuerte/x86_64/src/ros-underlay/ros/core/roslib/src/roslib/", line 42, in <module>
    import rospkg
ImportError: No module named rospkg

jwienke@augit:/vol/corcse/ros-fuerte/x86_64/src/PyYAML-3.10$ echo $PYTHONPATH

With the patch mentioned below I am now able to use roslib. However rospy and std_msgs do not work:

jwienke@augit:/vol/corcse/ros-fuerte/x86_64/src/ros-underlay/ros/core/roslib/src/roslib$ python3
Python 3.1.2 (r312:79147, Dec  9 2011, 20:47:34) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rospy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/vol/corcse/ros-fuerte/x86_64/lib/python2.6/site-packages/ros_comm-1.8.7-py2.6.egg/rospy/", line 47, in <module>
    from std_msgs.msg import Header
  File "/vol/corcse/ros-fuerte/x86_64/lib/python2.6/site-packages/std_msgs/msg/", line 1, in <module>
    from _Bool import *
ImportError: No module named _Bool
edit retag flag offensive close merge delete

5 Answers

Sort by » oldest newest most voted

answered 2012-05-03 04:36:37 -0600

michikarg gravatar image

updated 2012-05-03 04:36:59 -0600

After playing around a bit with ROS and Python3, i basically got ROS messaging running from python2 and 3! A created a ticket and patches, so feel free to test:

I also had to fix genpy. You can download the lated trunk (already including my patch the fixes your problem with the _Bool import) from github:



edit flag offensive delete link more

answered 2012-04-25 06:12:29 -0600

joq gravatar image

To limit confusion for those reading this page, @michikarg and @languitar are discussing useful work for future python3 migration, done in branches of various core ROS components.

ROS Fuerte does not officially support python3.

edit flag offensive delete link more



Thanks, i should have pointed that out at the beginning of my answer.

michikarg gravatar image michikarg  ( 2012-04-25 20:06:51 -0600 )edit

answered 2012-04-25 03:26:44 -0600

michikarg gravatar image

Here is a patch for /opt/ros/fuerte/lib/python2.7/dist-packages/roslib/ that allows you to import roslib using Python3. Let me know if this worked for you:

edit flag offensive delete link more

answered 2012-04-25 02:56:16 -0600

michikarg gravatar image

I am one step further now! rospkg is now standalone, so you will have to install it with the correct python-version and user:

  1. Git clone it:

    git clone git://

  2. Install it using Python3:

    python3.2 install --user

This basically solved the issue of the rospkg-module not beeing found. However it raises another issue for me when iḿ trying to import roslib:

>>> import roslib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/roslib/", line 54, in <module>
    import roslib.stacks
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/roslib/", line 190
    print "ROS_PATHS", ros_paths, env['ROS_PACKAGE_PATH']

This could be related to missing Python3-support in roslib, so i guess we will have to write some more patches....

edit flag offensive delete link more


I could also fix that very easily... i will write a patch for it...

michikarg gravatar image michikarg  ( 2012-04-25 03:04:31 -0600 )edit

answered 2012-04-24 23:51:29 -0600

michikarg gravatar image

updated 2012-04-25 20:08:47 -0600

NOTE: ROS Fuerte DOES NOT officially support Python3! Although the following discussion is about work in progress for partial Python3 compatibility!


we patched parts of ros core and ros_comm for python3 so basically messaging should be possible.

You just have to set you Pythonpath to roslib and in set your yaml-folder (in case you need it) to the pyyaml you installed using python3:

export PYTHONPATH=$PYYAML_DIR/pyyaml/lib/python3.2/site-packages:/opt/ros/electric/ros/core/roslib/src

After importing roslib in your python-file, you should be able to normally use roslib.load_manifest and code in Python3.

So far i only used it with ROS Electric, but i will install Fuerte quite soon and check if everything works....

edit flag offensive delete link more


I just installed Fuerte and ended up with "ImportError: No module named rospkg". Since rospack is now standalone, i installed it for Python2 and 3 but this seems not to work either...

michikarg gravatar image michikarg  ( 2012-04-25 02:41:22 -0600 )edit

I'll open a new question for this topic...

michikarg gravatar image michikarg  ( 2012-04-25 02:43:03 -0600 )edit

Question Tools



Asked: 2012-04-24 22:02:22 -0600

Seen: 1,807 times

Last updated: May 03 '12