Ask Your Question
0

ImportError: No module named rospkg

asked 2018-09-10 11:02:22 -0600

dovulthesloth gravatar image

Hello,

I use Ubuntu 16.04 LTS, ROS Kinetic, and Anaconda. Python 3.6 is my default python. Now I'm following ROS Tutorials, particularly this part: http://wiki.ros.org/ROS/Tutorials/Und... .

So I wanna run this command:

$ rosrun rqt_graph rqt_graph

But I get this Error messages all the time,

rosrun rqt_graph rqt_graph
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/rqt_graph/rqt_graph", line 5, in <module>
    from rqt_gui.main import Main
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_gui/main.py", line 38, in <module>
    import rospy
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/__init__.py", line 49, in <module>
    from .client import spin, myargv, init_node, \
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/client.py", line 52, in <module>
    import roslib
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/__init__.py", line 50, in <module>
    from roslib.launcher import load_manifest
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/launcher.py", line 42, in <module>
    import rospkg
ModuleNotFoundError: No module named 'rospkg'

I've already installed ROS Packages with:

 sudo apt-get install python-rospkg

And I get the same problem in venv as well. Thank you in advance for your answers. :)

edit retag flag offensive close merge delete

Comments

1

The problem is probably due to Anaconda which requires you to modify your path. Search around on the site and you'll find many people with similar problems.

jayess gravatar imagejayess ( 2018-09-10 11:31:52 -0600 )edit

Yeah I found some similar problems, I think I'll just unistall anaconda then. It is the simplest solution.

dovulthesloth gravatar imagedovulthesloth ( 2018-09-10 11:35:19 -0600 )edit

I don't think that you have to uninstall Anaconda. You can probably just remove the line from your .bashrc file that adds Anaconda to your path. If you want to use Anaconda you can add it to your path manually. Keep in mind that I don't use Anaconda though.

jayess gravatar imagejayess ( 2018-09-10 16:15:52 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-09-10 18:40:51 -0600

Geoff gravatar image

Following up the comments by @jayess, you can remove the references to Anaconda from your .bashrc file (or any other startup files you have them in. You don't need to uninstall Anaconda. Removing the references to it in your startup files disables it, giving you the option of enabling it manually as needed.

Adding a function to your .bashrc file to enable Anaconda is a good way to make it easy to enable on an as-needed basis. (This works for anything else that goes in the .bashrc file as well, like ROS if you want to be able to switch distributions quickly.)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-09-10 11:02:22 -0600

Seen: 854 times

Last updated: Sep 10 '18