0
$\begingroup$

Rosanswers logo

Hi all, I want to generate msg header files in a 64-bit Ubuntu 12.04 (ROS Hydro) by catkin_make agile_grasp_generate_messages. However, I got some error messages indicating that there's no Interpreter() in em module as the error occurs at the line interpreter = em.Interpreter(...) in genmsg/template_tools.py.

I think the error might relates to anaconda I installed before, because when I type python in my terminal, I got:

Python 2.7.9 |Anaconda 2.2.0 (64-bit)| (default, Mar  9 2015, 16:20:48) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> 

and when I locate em.py, there are many candidates: (but those em.py under nltk dir do not contain class Interpreter)

/home/rosfuerte/anaconda/lib/python2.7/site-packages/nltk/cluster/em.py
/home/rosfuerte/anaconda/lib/python2.7/site-packages/nltk/cluster/em.pyc
/home/rosfuerte/anaconda/pkgs/nltk-3.0.2-np19py27_0/lib/python2.7/site-packages/nltk/cluster/em.py
/home/rosfuerte/anaconda/pkgs/nltk-3.0.2-np19py27_0/lib/python2.7/site-packages/nltk/cluster/em.pyc
/usr/lib/pymodules/python2.7/em.py
/usr/lib/pymodules/python2.7/em.pyc
/usr/local/lib/python2.7/dist-packages/nltk/cluster/em.py
/usr/local/lib/python2.7/dist-packages/nltk/cluster/em.pyc
/usr/share/pyshared/em.py
/usr/share/software-center/softwarecenter/ui/gtk3/em.py

So I remove the anoconda from my path by export PATH=... to remove anaconda/bin from PATH variable. After that, when I type python, I got:

Python 2.7.3 (default, Jun 22 2015, 19:33:41) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

But even I set the PATH to exlude anaconda/bin, I still got the same error when I catkin_make agile_grasp_generate_messages. Does anyone know how to solve this problem?

FYI, here's my error messages: (I think the key error is AttributeError: 'module' object has no attribute 'Interpreter')

Generating Lisp code from agile_grasp/Grasps.msg
Generating Lisp code from agile_grasp/CloudSized.msg
Generating Lisp code from agile_grasp/Grasp.msg
Generating EusLisp code from agile_grasp/Grasp.msg
Generating EusLisp code from agile_grasp/CloudSized.msg
Generating EusLisp code from agile_grasp/Grasps.msg
[ 57%] Generating C++ code from agile_grasp/Grasp.msg
Generating EusLisp manifest code for agile_grasp
[ 64%] Traceback (most recent call last):
  File "/opt/ros/hydro/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 49, in <module>
    srv_template_map)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 215, in generate_from_command_line_options
    generate_from_file(argv[1], options.package, options.outdir, options.emdir, options.includepath, msg_template_dict, srv_template_dict)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 156, in generate_from_file
    _generate_msg_from_file(input_file, output_dir, template_dir, search_path, package_name, msg_template_dict)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 101, in _generate_msg_from_file
    search_path)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 79, in _generate_from_spec
    interpreter = em.Interpreter(output=ofile, globals=g, options={em.RAW_OPT:True,em.BUFFERED_OPT:True})
AttributeError: 'module' object has no attribute 'Interpreter'
Generating C++ code from agile_grasp/CloudSized.msg
[ 71%] make[3]: *** [/home/rosfuerte/code/ros_hydro/devel/include/agile_grasp/Grasp.h] Error 1
make[3]: *** Waiting for unfinished jobs....
[ 71%] Built target agile_grasp_generate_messages_lisp
Generating C++ code from agile_grasp/Grasps.msg
[ 78%] [ 85%] [ 92%] Generating Python from MSG agile_grasp/Grasps
Generating Python from MSG agile_grasp/Grasp
Generating Python from MSG agile_grasp/CloudSized
Traceback (most recent call last):
  File "/opt/ros/hydro/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 49, in <module>
    srv_template_map)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 215, in generate_from_command_line_options
    generate_from_file(argv[1], options.package, options.outdir, options.emdir, options.includepath, msg_template_dict, srv_template_dict)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 156, in generate_from_file
    _generate_msg_from_file(input_file, output_dir, template_dir, search_path, package_name, msg_template_dict)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 101, in _generate_msg_from_file
    search_path)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 79, in _generate_from_spec
    interpreter = em.Interpreter(output=ofile, globals=g, options={em.RAW_OPT:True,em.BUFFERED_OPT:True})
AttributeError: 'module' object has no attribute 'Interpreter'
make[3]: *** [/home/rosfuerte/code/ros_hydro/devel/include/agile_grasp/CloudSized.h] Error 1
Traceback (most recent call last):
  File "/opt/ros/hydro/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 49, in <module>
    srv_template_map)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 215, in generate_from_command_line_options
    generate_from_file(argv[1], options.package, options.outdir, options.emdir, options.includepath, msg_template_dict, srv_template_dict)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 156, in generate_from_file
    _generate_msg_from_file(input_file, output_dir, template_dir, search_path, package_name, msg_template_dict)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 101, in _generate_msg_from_file
    search_path)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 79, in _generate_from_spec
    interpreter = em.Interpreter(output=ofile, globals=g, options={em.RAW_OPT:True,em.BUFFERED_OPT:True})
AttributeError: 'module' object has no attribute 'Interpreter'
make[3]: *** [/home/rosfuerte/code/ros_hydro/devel/include/agile_grasp/Grasps.h] Error 1
make[2]: *** [agile_grasp/CMakeFiles/agile_grasp_generate_messages_cpp.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
[100%] Generating Python msg __init__.py for agile_grasp
[100%] Built target agile_grasp_generate_messages_py
[100%] Built target agile_grasp_generate_messages_eus
make[1]: *** [agile_grasp/CMakeFiles/agile_grasp_generate_messages.dir/rule] Error 2
make: *** [agile_grasp_generate_messages] Error 2
Invoking "make" failed

Originally posted by Po-Jen Lai on ROS Answers with karma: 1371 on 2015-07-24

Post score: 1


Original comments

Comment by Cerin on 2015-12-13:
I just ran into the same error and reported it as a bug in the rosserial repo. Were you ever able to resolve this?

Comment by silgon on 2015-12-15:
Any news? I'm kind of having the same problem with anaconda

Comment by yenWu on 2018-01-03:
Just passing by. You should install python module empy rather than empty and em.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Answered here.

The problem is that there are two conflicting Python packages installed, "em" and "empy", which unfortunately both create the package "em". EmPy is used by catkin, and what it expects, so you'll need to uninstall em to fix the error.


Originally posted by Cerin with karma: 940 on 2016-03-24

This answer was ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.