Ask Your Question
0

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

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

anirban gravatar image

Hi,

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/libpython3.7m.so

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/libpython3.7m.so
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/libpython3.7m.so -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
-- Using CATKIN_ENABLE_TESTING: ON
-- 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):
execute_process(/usr/bin/python3
"/opt/ros/kinetic/share/catkin/cmake/parse_package_xml.py"
"/opt/ros/kinetic/share/catkin/cmake/../package.xml"
"/home/simbot/baxter_ws/build/catkin/catkin_generated/version/package.cmake")
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 https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl
Collecting docutils (from catkin_pkg)
Using cached https://files.pythonhosted.org/packages/3a/dc/bf2b15d1fa15a6f7a9e77a61b74ecbbae7258558fcda8ffc9a6638a6b327/docutils-0.15.2-py2-none-any.whl
Collecting pyparsing (from catkin_pkg)
Using cached https://files.pythonhosted.org/packages/11/fa/0160cd525c62d7abd076a070ff02b2b94de589f1a9789774f17d7c54058e/pyparsing-2.4.2-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil->catkin_pkg)
Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil, docutils, pyparsing, catkin-pkg
Successfully installed catkin-pkg-0.4.14 docutils-0.15 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Comments

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

anirban gravatar imageanirban ( 2019-10-28 13:25:56 -0600 )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 https://answers.ros.org/question/2950...

duck-development gravatar imageduck-development ( 2019-10-28 13:34:46 -0600 )edit

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

anirban gravatar imageanirban ( 2019-10-28 14:26:24 -0600 )edit

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: 2019-10-27 11:08:43 -0600

Seen: 60 times

Last updated: Oct 28