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

ImportError: No module named 'rospkg' on hydro <SOLVED>

asked 2013-09-30 00:18:29 -0500

tub gravatar image

updated 2016-10-24 09:03:04 -0500

ngrennan gravatar image

Hi poeple,

In installed ros-hydro on ubuntu 13.04.

I am trying to get the "morse-simulation": http://www.openrobots.org/wiki/morse/ to work with ros hydro. but I always get an error message when starting my simulation (for example the "tutorial-1-ros.py"):

[helpers.loading] Module not found: Could not import some ROS modules. Check your ROS configuration is ok. Details:
No module named 'rospkg'
[helpers.loading] Could not load the class RosRequestManager in morse.middleware.ros_request_manager
[helpers.loading] Could not create an instance of morse.middleware.ros_request_manager.RosRequestManager

when running "import ros" in python3 i get:

>>> import ros
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/ros/hydro/lib/python2.7/dist-packages/ros/__init__.py", line 41, in <module>
    import roslib
  File "/opt/ros/hydro/lib/python2.7/dist-packages/roslib/__init__.py", line 50, in <module>
    from roslib.launcher import load_manifest
  File "/opt/ros/hydro/lib/python2.7/dist-packages/roslib/launcher.py", line 42, in <module>
    import rospkg
ImportError: No module named 'rospkg'

any idea for a solution of this problem?

edit retag flag offensive close merge delete

Comments

What if I do not use catkin? Because all along I am using rosbuild. Sorry if making any inconvenient I am a new programmer.

FuerteNewbie gravatar image FuerteNewbie  ( 2013-10-02 17:09:42 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2013-09-30 02:26:09 -0500

tub gravatar image

updated 2014-04-03 21:13:56 -0500

130s gravatar image

well.. after some more tinkering I found out how to solve this.

I found a solution for the problem: it seems that python3 finds ros, but it does not find specifically the packages rospkg, catkin_pkg and yaml, which are required for morse-simultion to work.

Thus you can just do: after using virtualenv for a virtual python3 installation you can just do:

pip-3.3 install catkin_pkg rospkg yaml

(if yaml installation does not work this way, then just do sudo apt-get install python3-yaml)

After that reconfigure morse with the new python directories (in my case /home/user/bin/python3.3) and everything should work fine.

edit flag offensive delete link more

Comments

2

You should edit this, and place the answer here..

SL Remy gravatar image SL Remy  ( 2013-10-03 02:48:07 -0500 )edit

I second to @trinighost; separating question and answers makes it so easier for other readers to find what was the effective solution/workaround. I've moved the finding to this answer.

130s gravatar image 130s  ( 2014-04-03 21:15:46 -0500 )edit
1

answered 2013-10-03 00:43:55 -0500

severin gravatar image

If you follow the MORSE installation instruction for ROS, you'll see you indeed need to install rospkg for Python 3. Everything should be explained there: if something is missing, please feel free to fill a bug report on MORSE or ask for support on morse-users@laas.fr.

edit flag offensive delete link more
0

answered 2013-09-30 00:58:19 -0500

fergs gravatar image

Have you tried installing

sudo apt-get install python-rospkg

Have you also sourced setup.bash from either your catkin workspace or /opt/ros/hydro in your current terminal?

edit flag offensive delete link more

Comments

yes, I did that but it seems that only python2.7 recognizes the package. when I do "import ros" in python2.7.4 everything works as expected

tub gravatar image tub  ( 2013-09-30 01:56:08 -0500 )edit

No sudo apt-get install python-rospkg aint solving this problem. my python is version 2.7 as well. ROS fuerte 12.04.

FuerteNewbie gravatar image FuerteNewbie  ( 2013-10-02 21:31:29 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-09-30 00:18:29 -0500

Seen: 6,131 times

Last updated: Apr 03 '14