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

"No module named catkin_pkg.package" on catkin_make w/ Hydro

asked 2015-03-02 00:14:59 -0500

khitrir gravatar image

Working with ROS Hydro on Lubuntu 12.04. I have previously worked with Hydro on this OS before so I am relatively sure theres no compatibility differences between it and the standard Ubuntu 12.04 release. All links below are either to wiki.ros or answers.ros.

I followed the ROS installation tutorial here, selecting the recommended options, and then proceeded to test the installation by following the first tutorial here. However, running: ~/catkin_ws$ catkin_make fails and shows the error down below.

There are several other questions here that deal with similar problems such as here and here, but following the solutions provided did not solve the issue. Here, the possibility of not using the system version of python is brought up. This is possibly the issue but I'm unsure how to confirm or remedy this. If this is the case, I'd have to add the catkin_pkg to the PYTHONPATH, but without confirmation that I am not using the system version of python I'm unsure how and where to do this.

Base path: /home/khitrir/catkin_ws
Source space: /home/khitrir/catkin_ws/src
Build space: /home/khitrir/catkin_ws/build
Devel space: /home/khitrir/catkin_ws/devel
Install space: /home/khitrir/catkin_ws/install
#### Running command: "cmake /home/khitrir/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/khitrir/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/khitrir/catkin_ws/install" in "/home/khitrir/catkin_ws/build"
-- Using CATKIN_DEVEL_PREFIX: /home/khitrir/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/hydro
-- This workspace overlays: /opt/ros/hydro
-- Using PYTHON_EXECUTABLE: /usr/local/bin/python
-- Python version: 2.7
-- Using Debian Python package layout
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/khitrir/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
ImportError: "from catkin_pkg.package import parse_package" failed: No module named catkin_pkg.package
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/hydro/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  returned error code 1
Call Stack (most recent call first):
  /opt/ros/hydro/share/catkin/cmake/catkin_package_xml.cmake:63 (safe_execute_process)
  /opt/ros/hydro/share/catkin/cmake/all.cmake:152 (_catkin_package_xml)
  /opt/ros/hydro/share/catkin/cmake/catkinConfig.cmake:20 (include)
  CMakeLists.txt:52 (find_package)

-- Configuring incomplete, errors occurred!
Invoking "cmake" failed
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2015-03-02 01:35:41 -0500

ahendrix gravatar image

If you haven't explicitly changed the version of python that you're using, you're probably still using the default. You can confirm which version of python you're using with:

which python
python -V

You can confirm that the python-catkin-pkg package is installed correctly by listing the files that it should contain:

dpkg -L python-catkin-pkg

The most important thing to verify here is that python-catkin-pkg is installed into a directory that matches your python version.

edit flag offensive delete link more


I though the issue was more the install paths than the actual version number? Regardless; the outputs are:

$ which python
$ python -V
Python 2.7.9
$ dpkg -L python-catkin-pkg

The last output is too long for a comment, see next.

khitrir gravatar image khitrir  ( 2015-03-02 04:12:51 -0500 )edit

dpkg returns: Many locations at /usr/lib/python2.7/dist-packages/catkin_pkg A single location at just /usr/lib/python2.7/dist-packages/ As well as 5 catkin_* at /usr/bin/

Is this not what's expected?

khitrir gravatar image khitrir  ( 2015-03-02 04:16:06 -0500 )edit

It looks like you have a custom install of python in /usr/local/bin that you're using instead of the system version. Did you install a custom version of python?

ahendrix gravatar image ahendrix  ( 2015-03-03 04:09:48 -0500 )edit

Not to my knowledge. Being pressed for time and failing to find out how to uninstall the custom version, I just reinstalled the OS, which has solved the problem.

khitrir gravatar image khitrir  ( 2015-03-08 10:39:17 -0500 )edit

I am facing a similar problem. ahendrix can u plz help? I am getting following outputs: sukrit@sukrit-Inspiron-3521:~$ which python /home/sukrit/anaconda/bin/python sukrit@sukrit-Inspiron-3521:~$ python -V Python 2.7.10 :: Anaconda 2.3.0 (64-bit) and dpkg is returning many locations

sg_774 gravatar image sg_774  ( 2015-10-02 00:10:45 -0500 )edit

@sg_744 it sounds like you have a different problem. Please ask a new question, and specifically mention that you're using Anaconda python.

ahendrix gravatar image ahendrix  ( 2015-10-02 00:43:38 -0500 )edit

Hi there, I'm using CI, and up there, python is 2.7.10, and throws the same error reported here. Package python-catkin-pkg is correctly installed, here is the build log. In my PC, python is 2.7.6 and everything runs well. Any idea?

carlosjoserg gravatar image carlosjoserg  ( 2015-10-27 05:09:46 -0500 )edit

Nevermind my previous comment, it looks like a CI-related issue.

carlosjoserg gravatar image carlosjoserg  ( 2015-10-27 11:15:12 -0500 )edit

answered 2016-10-14 17:50:51 -0500

CesarVerdes gravatar image

Please try with conda install -c auto catkin_pkg

edit flag offensive delete link more


This solved my issue in indigo.

ericnumeric gravatar image ericnumeric  ( 2017-02-21 13:59:01 -0500 )edit

I get this eeror when doing that

UnsatisfiableError: The following specifications were found to be in conflict:
  - catkin_pkg -> argparse -> python 2.7* -> openssl 1.0.1*
  - python 3.6*
Use "conda info <package>" to see the dependencies for each package.
Kailegh gravatar image Kailegh  ( 2017-03-13 12:05:59 -0500 )edit

This worked for me. Thank you very much. I think something changed after installing anaconda

Anurag gravatar image Anurag  ( 2017-04-25 09:40:41 -0500 )edit

answered 2016-05-27 01:01:53 -0500

houpf gravatar image

I have the same problem after anaconda is installed. In the end of file ~/.bashrc, you will find export PATH="/home/houpf/anaconda2/bin:$PATH" . In fact the ROS should use python in /opt/ros/indigo/lib/python2.7/dist-packages. Uncomment it and source ~/.bashrc then it works.

edit flag offensive delete link more

Question Tools



Asked: 2015-03-02 00:14:59 -0500

Seen: 14,835 times

Last updated: Oct 14 '16