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

rosrun rqt_graph rqt_graph (Import error: no module named rospkg)(Is this is related to anaconda?)

asked 2016-09-07 08:27:42 -0600

NEO gravatar image

updated 2016-09-07 11:45:21 -0600

Problem started when i executed rosrun as mentioned in question, then i installed rospkg using command

sudo apt-get install python-rospkg

and rospkg got installed in /usr/lib/python2.7/dist-packages/rospkg , but after that import error still showing. I am using anaconda too on my laptop and python2.7 is default for anaconda. One interesting point i got here that i have installed rospkg in python2.7 but when i am importing rospkg in python3.4, it is working.

edit retag flag offensive close merge delete

Comments

Please add anaconda to the title and tags since the problem is very likely related to that.

Dirk Thomas gravatar image Dirk Thomas  ( 2016-09-07 08:54:43 -0600 )edit

What are the permissions on /usr/lib/python2.7/dist-packages/rospkg ?

SL Remy gravatar image SL Remy  ( 2016-09-08 12:40:00 -0600 )edit

default for all user

NEO gravatar image NEO  ( 2016-09-08 21:50:59 -0600 )edit

I've had a case where I was not able to read some of the directories in dist-packages so when I did an import of that module, python was unable to do so. This is the reason why I was asking about the permissions.

SL Remy gravatar image SL Remy  ( 2016-09-09 08:25:56 -0600 )edit

I also notice that on my machine, python2 and python2.7 somehow do different things.... So python -c "import rospkg" works, but python2.7 -c "import rospkg" does not... (just in case this isn't weird enough!)

SL Remy gravatar image SL Remy  ( 2016-09-09 08:28:46 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-12-06 14:02:15 -0600

This error occurs because only Python packages in /opt are added to PYTHONPATH environment. I'm reading about python-rospkg and I found that this package is installed in /usr. You only have to type "export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages" and this line will be add in your .bashrc file. In my case, that was the solution that fix the error.

edit flag offensive delete link more

Comments

It works, thanks a lot!

adayoegi gravatar image adayoegi  ( 2018-02-14 20:24:22 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2016-09-07 08:27:42 -0600

Seen: 1,790 times

Last updated: Sep 07 '16