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

Template file not found error

asked 2014-09-08 22:20:09 -0600

ryan0270 gravatar image

I'm running through the msg and srv tutorial and get a template file not found error during catkin_make. As far as I can tell, I have done everything according to the tutorial so am not sure what might be wrong. I am running Arch Linux instead of Ubuntu, but so far everything else I have done has worked well.

Here is the full catkin_make

[ryantr@lappyICSL catkin_ws]$ catkin_make
Base path: /home/ryantr/Software/ros/catkin_ws
Source space: /home/ryantr/Software/ros/catkin_ws/src
Build space: /home/ryantr/Software/ros/catkin_ws/build
Devel space: /home/ryantr/Software/ros/catkin_ws/devel
Install space: /home/ryantr/Software/ros/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/ryantr/Software/ros/catkin_ws/build"
####
####
#### Running command: "make -j8 -l8" in "/home/ryantr/Software/ros/catkin_ws/build"
####
[  0%] [  0%] [  0%] Built target std_msgs_generate_messages_cpp
Built target std_msgs_generate_messages_lisp
Built target std_msgs_generate_messages_py
[ 37%] [ 37%] [ 37%] [ 50%] Generating Lisp code from beginner_tutorials/AddTwoInts.srv
Generating C++ code from beginner_tutorials/AddTwoInts.srv
Generating Lisp code from beginner_tutorials/Num.msg
Generating C++ code from beginner_tutorials/Num.msg
Traceback (most recent call last):
  File "/opt/ros/hydro/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 41, in <module>
    import genmsg.template_tools
  File "/opt/ros/hydro/lib/python2.7/site-packages/genmsg/template_tools.py", line 74
    raise RuntimeError, "Template file %s not found in template dir %s" % (template_file_name, template_dir)
                      ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "/opt/ros/hydro/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 41, in <module>
    import genmsg.template_tools
  File "/opt/ros/hydro/lib/python2.7/site-packages/genmsg/template_tools.py", line 74
    raise RuntimeError, "Template file %s not found in template dir %s" % (template_file_name, template_dir)
                      ^
SyntaxError: invalid syntax
beginner_tutorials/CMakeFiles/beginner_tutorials_generate_messages_cpp.dir/build.make:62: recipe for target '/home/ryantr/Software/ros/catkin_ws/devel/include/beginner_tutorials/AddTwoInts.h' failed
make[2]: *** [/home/ryantr/Software/ros/catkin_ws/devel/include/beginner_tutorials/AddTwoInts.h] Error 1
make[2]: *** Waiting for unfinished jobs....
beginner_tutorials/CMakeFiles/beginner_tutorials_generate_messages_cpp.dir/build.make:54: recipe for target '/home/ryantr/Software/ros/catkin_ws/devel/include/beginner_tutorials/Num.h' failed
make[2]: *** [/home/ryantr/Software/ros/catkin_ws/devel/include/beginner_tutorials/Num.h] Error 1
CMakeFiles/Makefile2:282: recipe for target 'beginner_tutorials/CMakeFiles/beginner_tutorials_generate_messages_cpp.dir/all' failed
make[1]: *** [beginner_tutorials/CMakeFiles/beginner_tutorials_generate_messages_cpp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Traceback (most recent call last):
  File "/opt/ros/hydro/lib/python2.7/site-packages/genlisp/genlisp_main.py", line 73, in genmain
    retcode = generate_srv(options.package, args[1:], options.outdir, search_path)
  File "/opt/ros/hydro/lib/python2.7/site-packages/genlisp/generate.py", line 732, in generate_srv
    generate_srv_from_spec(msg_context, spec, search_path, out_dir, pkg, f)
  File "/opt/ros/hydro/lib/python2.7/site-packages/genlisp/generate.py", line 843, in generate_srv_from_spec
    write_srv_component(s, spec.request, msg_context, spec)
  File "/opt/ros/hydro/lib/python2.7/site-packages/genlisp/generate.py", line 690, in write_srv_component
    write_md5sum(s, context, spec, parent=parent)
  File "/opt/ros/hydro/lib/python2.7/site-packages/genlisp/generate.py", line 591, in write_md5sum
    md5sum = genmsg.compute_md5(msg_context, parent or spec)
Traceback (most recent ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-09-10 21:37:25 -0600

ryan0270 gravatar image

Found the problem: it was finding the wrong version of Python. Arch linux defaults to python 3 so tricks have to be used to get it use 2.7 for ROS. The arch linux ros install wiki gives a function I added to my .bashrc to setup the environment

# ROS
hydro() {
  source /opt/ros/hydro/setup.bash
  export ROS_PACKAGE_PATH=/path/to/your/your/package/path:$ROS_PACKAGE_PATH
  export PYTHONPATH=/opt/ros/hydro/lib/python2.7/site-packages:$PYTHONPATH
  export PKG_CONFIG_PATH="/opt/ros/hydro/lib/pkgconfig:$PKG_CONFIG_PATH"
  alias python=/usr/bin/python2

  # Gazebo
  source /usr/share/gazebo/setup.sh
}

But in the case of catkin_make that apparently isn't enough. I found that I also need to pass all the options in to catkin_make, i.e.

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-09-08 22:20:09 -0600

Seen: 1,034 times

Last updated: Sep 10 '14