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

Error "No module named 'catkin_pkg'" while creating catkin_package

asked 2019-10-27 11:08:43 -0500

anirban gravatar image


I am creating catkin package and for that I have been following this page. I can run all the commands in that page correctly with out error except the following one

$ catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.7m -DPYTHON_LIBRARY=/usr/lib/

While I run the above command I get the error as follows

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.7m -DPYTHON_LIBRARY=/usr/lib/
Base path: /home/simbot/baxter_ws
Source space: /home/simbot/baxter_ws/src
Build space: /home/simbot/baxter_ws/build
Devel space: /home/simbot/baxter_ws/devel
Install space: /home/simbot/baxter_ws/install
#### Running command: "cmake /home/simbot/baxter_ws/src -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.7m -DPYTHON_LIBRARY=/usr/lib/ -DCATKIN_DEVEL_PREFIX=/home/simbot/baxter_ws/devel -DCMAKE_INSTALL_PREFIX=/home/simbot/baxter_ws/install -G Unix Makefiles" in "/home/simbot/baxter_ws/build"
-- Using CATKIN_DEVEL_PREFIX: /home/simbot/baxter_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Found PythonInterp: /usr/bin/python3 (found version "3.5.2") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/simbot/baxter_ws/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
returned error code 1
Call Stack (most recent call first):
/opt/ros/kinetic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process)
/opt/ros/kinetic/share/catkin/cmake/all.cmake:167 (_catkin_package_xml)
/opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:56 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/simbot/baxter_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/simbot/baxter_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

From the error I can understand that I am missing 'catkin_pkg' . So I tried to follow the instructions given in this page by running the command pip install catkin_pkg and I am prompted with successful installation with the following message,

Collecting catkin_pkg
Collecting python-dateutil (from catkin_pkg)
Using cached
Collecting docutils (from catkin_pkg)
Using cached
Collecting pyparsing (from catkin_pkg)
Using cached
Collecting six>=1.5 (from python-dateutil->catkin_pkg)
Using cached
Installing collected packages: six, python-dateutil, docutils, pyparsing, catkin-pkg
Successfully installed catkin-pkg-0.4.14 docutils-0.15 ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-10-28 04:32:53 -0500

duck-development gravatar image

Why you try to use python 3 use python2 as kinetic use only phython2.

Are you a arch Linux user? Because then you have to enter the error throwing line.

edit flag offensive delete link more


I am not an Arch Linux user. But I still want to use Pythin3 based catkin_make for my future developments.

anirban gravatar image anirban  ( 2019-10-28 13:25:56 -0500 )edit

Then you may have to uninstall python2 or use pip3 to install the proper libraries

Melodic use python2 as default.

On arch Linux you have only python3

The answer here may help you

duck-development gravatar image duck-development  ( 2019-10-28 13:34:46 -0500 )edit

Thank you for pointing to the right post and that answers my question.

anirban gravatar image anirban  ( 2019-10-28 14:26:24 -0500 )edit

Question Tools



Asked: 2019-10-27 11:08:43 -0500

Seen: 926 times

Last updated: Oct 28 '19