Ask Your Question
0

Import Error:No module named rospkg

asked 2013-10-01 16:57:07 -0500

FuerteNewbie gravatar image

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

ngrennan gravatar image

Hi,

Error (Happened after I fixed the error above and I tried to rosrun tf view_frames)

user@ubuntu:~$ rosrun tf view_frames 
Traceback (most recent call last):
  File "/opt/ros/fuerte/stacks/geometry/tf/scripts/view_frames", line 43, in <module>
    import roslib; roslib.load_manifest(PKG) 
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/roslib/__init__.py", line 50, in <module>
    from roslib.launcher import load_manifest
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/roslib/launcher.py", line 42, in <module>
    import rospkg
ImportError: No module named rospkg

Solution executed: (Make no difference) $sudo apt-get install python-rospkg $sudo apt-get install --reinstall ros-fuerte-ros-comm reinstall python 2.7

user@ubuntu:~$ env | grep ROS
ROS_ROOT=/opt/ros/fuerte/share/ros
ROSLISP_PACKAGE_DIRECTORY=/opt/ros/fuerte/share/common-lisp/ros
ROS_PACKAGE_PATH=/opt/ros/fuerte/share:/opt/ros/fuerte/stacks
ROS_MASTER_URI=http://localhost:11311
ROS_DISTRO=fuerte
ROS_ETC_DIR=/opt/ros/fuerte/etc/ros

PYTHONPATH=/opt/ros/fuerte/lib/python2.7/dist-packages:/opt/ros/fuerte/lib/python2.7/dist-packages:

Please help I can't continue with my work, very much appreciated.

edit retag flag offensive close merge delete

Comments

What is your PYTHON_PATH?

tfoote gravatar imagetfoote ( 2013-10-03 20:23:21 -0500 )edit

/opt/ros/fuerte/lib/python2.7/dist-packages:/home/user/usr/lib/pymodules/python2.7/ I just added 'export $PYTHONPATH=/usr/lib/pymodules/python2.7/' that's it looks a little different right now, after I add it into pythonpath now my bad marshall data(string ref out of range) come back again..

FuerteNewbie gravatar imageFuerteNewbie ( 2013-10-03 20:39:59 -0500 )edit

How to set my pythonpath back to default?

FuerteNewbie gravatar imageFuerteNewbie ( 2013-10-03 20:45:44 -0500 )edit

If you open a new terminal that will reset your environment back to what's in you ~/.bashrc is there anything in that? Can you share what your env is with 'env | grep ROS && env | grep PY. Please add it as an edit of your question to get good formatting.

tfoote gravatar imagetfoote ( 2013-10-03 20:53:48 -0500 )edit

What happens if you just open `python` and type `import rospkg`?

dornhege gravatar imagedornhege ( 2013-10-04 00:52:41 -0500 )edit

What Ubuntu version are you using and what Python version?

Dirk Thomas gravatar imageDirk Thomas ( 2013-10-05 08:45:12 -0500 )edit

I am using python 2.7, it was functioning well before. Until I edit my roslaunch file someday and trying to roslaunch it and the python seems to be crashed on that time. @dornhege >>> import rospkg Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named rospkg

FuerteNewbie gravatar imageFuerteNewbie ( 2013-10-06 15:18:27 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-10-02 03:40:56 -0500

tfoote gravatar image

That's an odd error.

As a random guess your installation is corrupted. I'd suggest trying sudo apt-get install --reinstall ros-fuerte-ros-comm

If you want to debug it you can manually try to reproduce by running the imports manually in a python instance.

edit flag offensive delete link more

Comments

Reinstall doesn't help. Does reinstalling python will do? How am I gonna do?

FuerteNewbie gravatar imageFuerteNewbie ( 2013-10-02 16:42:42 -0500 )edit

From your update that it's failing to import rospkg. Check that you don't have a pip version of rospkg and try reinstalling python-rospkg in the same way as above.

tfoote gravatar imagetfoote ( 2013-10-02 22:29:52 -0500 )edit

I have tried sudo apt-get python-rospkg and it doesn't make any different, that's the problem right now.

FuerteNewbie gravatar imageFuerteNewbie ( 2013-10-02 22:43:07 -0500 )edit

Reinstall fuerte still can't fix the problem.

FuerteNewbie gravatar imageFuerteNewbie ( 2013-10-02 23:54:44 -0500 )edit

Bad marshal data fixed after I reboot my computer.

FuerteNewbie gravatar imageFuerteNewbie ( 2013-10-06 15:21:48 -0500 )edit

I have the same problem. I cannot even import rospkg within python. rospkg is not in my /usr/lib/pymodules/python2.7 directory. There are 2 rospkg_loader.* files within the rosdep2 subfolder. Im not sure whats going on but I keep getting the "ImportError: No module named rospkg" when running roscore

tgaaly gravatar imagetgaaly ( 2013-12-07 04:29:38 -0500 )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

1 follower

Stats

Asked: 2013-10-01 16:57:07 -0500

Seen: 6,026 times

Last updated: Oct 03 '13