Ask Your Question
0

Import error catkin_pkg while importing rosbag, roslib and rospy

asked 2017-10-20 10:37:03 -0600

Ashutosh Mishra gravatar image

I am novice to ROS and I followed the ROS installation tutorial to install ROS kinetic. After installing, I open python to import rospy, roslib and rosbag, but it throws the following error:

import roslib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/__init__.py", line 54, in <module>
    import roslib.stacks
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/stacks.py", line 46, in <module>
    import roslib.packages
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/packages.py", line 49, in <module>
    from catkin.find_in_workspaces import find_in_workspaces as catkin_find
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/catkin/find_in_workspaces.py", line 36, in <module>
    from catkin_pkg.packages import find_packages
ImportError: No module named catkin_pkg.packages

I again installed catkin_pkg using the following command but nothing happened:

  sudo apt-get install --reinstall python-catkin-pkg

Can anyone suggest me where I am going wrong?

edit retag flag offensive close merge delete

Comments

Please tell us how you installed ROS: using apt-get or building from sources, on which Linux distribution this is and which "ROS installation tutorial" you followed (link).

gvdhoorn gravatar imagegvdhoorn ( 2017-10-20 10:44:03 -0600 )edit

Also: do you source /opt/ros/kinetic/setup.bash before starting the python interpreter?

gvdhoorn gravatar imagegvdhoorn ( 2017-10-20 10:56:46 -0600 )edit

Yes I did source /opt/ros/kinetic/setup.bash and I followed the following link for installation: http://wiki.ros.org/kinetic/Installat...

Ashutosh Mishra gravatar imageAshutosh Mishra ( 2017-10-20 11:15:17 -0600 )edit
1

Please post the output of python -c "import catkin_pkg; print(catkin_pkg.__file__)".

Dirk Thomas gravatar imageDirk Thomas ( 2017-10-20 11:22:05 -0600 )edit

Thanks a lot, this link helped me https://answers.ros.org/question/1264... , particularly installing pip install catkin_pkg

Ashutosh Mishra gravatar imageAshutosh Mishra ( 2017-10-20 11:36:11 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-10-20 11:47:16 -0600

Dirk Thomas gravatar image

As the comments on the referenced question mention you should not install catkin_pkg via pip. This is why you have the problem in the first place. And when the next version is released as a Debian package you will have the same problem again since your old pip package overlays the new Debian pkg.

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

1 follower

Stats

Asked: 2017-10-20 10:37:03 -0600

Seen: 617 times

Last updated: Oct 20 '17