Search code examples
pythoncmakemessageroscatkin

Invoking "make install -j8 -l8"failed


I try to learn ROS Tutorials in topic "Creating a ROS msg and srv" but in finally I can't $ catkin_make install

this is result :

snow@snow-PE60-2QE:~/catkin_ws$ catkin_make install
Base path: /home/snow/catkin_ws
Source space: /home/snow/catkin_ws/src
Build space: /home/snow/catkin_ws/build
Devel space: /home/snow/catkin_ws/devel
Install space: /home/snow/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/snow/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/snow/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/snow/catkin_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /home/snow/catkin_ws/devel;/opt/ros/kinetic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.5.2", minimum required is "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/snow/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.5.2") 
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.20
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'beginner_tutorials'
-- ==> add_subdirectory(beginner_tutorials)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- beginner_tutorials: 1 messages, 0 services
-- Configuring done
-- Generating done
-- Build files have been written to: /home/snow/catkin_ws/build
####
#### Running command: "make install -j8 -l8" in "/home/snow/catkin_ws/build"
####
Scanning dependencies of target _beginner_tutorials_generate_messages_check_deps_Num
Scanning dependencies of target std_msgs_generate_messages_eus
Scanning dependencies of target std_msgs_generate_messages_lisp
Scanning dependencies of target std_msgs_generate_messages_py
Scanning dependencies of target std_msgs_generate_messages_nodejs
Scanning dependencies of target std_msgs_generate_messages_cpp
[  0%] Built target std_msgs_generate_messages_cpp
[  0%] Built target std_msgs_generate_messages_py
[  0%] Built target std_msgs_generate_messages_nodejs
[  0%] Built target std_msgs_generate_messages_lisp
[  0%] Built target std_msgs_generate_messages_eus
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_Num
Scanning dependencies of target beginner_tutorials_generate_messages_py
Scanning dependencies of target beginner_tutorials_generate_messages_lisp
Scanning dependencies of target beginner_tutorials_generate_messages_cpp
Scanning dependencies of target beginner_tutorials_generate_messages_nodejs
Scanning dependencies of target beginner_tutorials_generate_messages_eus
[ 28%] Generating C++ code from beginner_tutorials/Num.msg
[ 28%] Generating Python from MSG beginner_tutorials/Num
[ 42%] Generating EusLisp manifest code for beginner_tutorials
[ 57%] Generating Lisp code from beginner_tutorials/Num.msg
[ 71%] Generating Javascript code from beginner_tutorials/Num.msg
[ 85%] Generating EusLisp code from beginner_tutorials/Num.msg
[ 85%] Built target beginner_tutorials_generate_messages_lisp
[ 85%] Built target beginner_tutorials_generate_messages_nodejs
Traceback (most recent call last):
  File "/opt/ros/kinetic/share/genpy/cmake/../../../lib/genpy/genmsg_py.py", line 44, in <module>
    import genpy.generator
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/genpy/__init__.py", line 34, in <module>
    from . message import Message, SerializationError, DeserializationError, MessageException, struct_I
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/genpy/message.py", line 44, in <module>
    import yaml
  File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 2, in <module>
    from error import *
ImportError: No module named 'error'
beginner_tutorials/CMakeFiles/beginner_tutorials_generate_messages_py.dir/build.make:62: recipe for target '/home/snow/catkin_ws/devel/lib/python3/dist-packages/beginner_tutorials/msg/_Num.py' failed
make[2]: *** [/home/snow/catkin_ws/devel/lib/python3/dist-packages/beginner_tutorials/msg/_Num.py] Error 1
CMakeFiles/Makefile2:567: recipe for target 'beginner_tutorials/CMakeFiles/beginner_tutorials_generate_messages_py.dir/all' failed
make[1]: *** [beginner_tutorials/CMakeFiles/beginner_tutorials_generate_messages_py.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 85%] Built target beginner_tutorials_generate_messages_cpp
[ 85%] Built target beginner_tutorials_generate_messages_eus
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make install -j8 -l8" failed

how can solve this?


Solution

  • This could happen when you have mixed up two python versions (/opt/ros/kinetic/lib/python2.7 and /home/snow/catkin_ws/devel/lib/python3). To solve this issue you have two options.

    1. Use python3 when you build the source: catkin build --cmake-args -DPYTHON_VERSION=3.6. You can find more info here.

    2. Change your code to use python2. To do that in your script first-line use "#!/usr/bin/env python3" instead of "#!/usr/bin/env python", but this way you may have to resolve the python compatibility issues in your code. Similar issue has been reported here.