0
$\begingroup$

Rosanswers logo

I'm walking through the tutorials and am on Introduction to msg and srv

I'm using Ubuntu 16.04 and Kinetic. My python is /usr/bin/python My pip is /usr/local/bin/pip

I'm running the command catkin_make install on Step 6 and I get the following 'em' not found error:

[ 69%] Generating Javascript code from beginner_tutorials/Num.msg [ 76%] Generating C++ code from beginner_tutorials/Num.msg [ 84%] Generating Javascript code from beginner_tutorials/AddTwoInts.srv Traceback (most recent call last): File "/opt/ros/kinetic/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 41, in <module> import genmsg.template_tools File "/opt/ros/kinetic/lib/python2.7/dist-packages/genmsg/template_tools.py", line 39, in <module> import em ImportError: No module named em beginner_tutorials/CMakeFiles/beginner_tutorials_generate_messages_cpp.dir/build.make:63: recipe for target '/home/philglau/catkin_ws/devel/include/beginner_tutorials/Num.h' failed make[2]: *** [/home/philglau/catkin_ws/devel/include/beginner_tutorials/Num.h] Error 1 make[2]: *** Waiting for unfinished jobs.... Traceback (most recent call last): File "/opt/ros/kinetic/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 41, in <module> import genmsg.template_tools File "/opt/ros/kinetic/lib/python2.7/dist-packages/genmsg/template_tools.py", line 39, in <module> import em ImportError: No module named em beginner_tutorials/CMakeFiles/beginner_tutorials_generate_messages_cpp.dir/build.make:70: recipe for target '/home/philglau/catkin_ws/devel/include/beginner_tutorials/AddTwoInts.h' failed 

So obviously, it thinks em is missing. So I ran both of the following to try to resolve it:

philglau@phil-glau-ubuntu-16:~$ sudo -H pip install empy Requirement already satisfied: empy in /usr/lib/python2.7/dist-packages 

And also tried:

philglau@phil-glau-ubuntu-16:~$ sudo apt-get install python-empy [sudo] password for philglau: Reading package lists... Done Building dependency tree Reading state information... Done python-empy is already the newest version (3.3.2-1build1). python-empy set to manually installed. The following packages were automatically installed and are no longer required: linux-headers-4.4.0-59 linux-headers-4.4.0-59-generic linux-image-4.4.0-59-generic linux-image-extra-4.4.0-59-generic Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 

And if I manually load python from the CLI, I can import em without it barking

philglau@phil-glau-ubuntu-16:~/catkin_ws$ python Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import em >>> 

Likewise if I directly run template_tools.py from the CLI it doesn't bark either:

python /opt/ros/kinetic/lib/python2.7/dist-packages/genmsg/template_tools.py 

I also 'reinstalled' ROS and it said 'nothing was updated.' I have not yet attempted to completely uninstall and then re-install, but hopefully that won't be necessary.

After all my attempts to fix this problem, I'm still getting the package not found error when running catkin_make as indicated in the tutorial. Any thoughts??

Thank you in advance for any help.

  • Phil

Originally posted by philglau on ROS Answers with karma: 248 on 2017-03-18

Post score: 4

$\endgroup$

4 Answers 4

0
$\begingroup$

Rosanswers logo

I think this has to do with a conflict between the python module 'em' and 'empy' both of which use the same name.

If you have 'em' installed, it seems to supersede 'empy' which is what is needed by ROS.

See this link for details

I ended up compiling from source before I figured this out. To resolve it on my self-compiled kinetic, I did:

pip uninstall em pip install empy 

And it seems to have fixed the problem. Kind of a frustrating error as the apt-get install covered in the tutorial doesn't automatically detect this conflict.


Originally posted by philglau with karma: 248 on 2017-03-19

This answer was ACCEPTED on the original site

Post score: 18


Original comments

Comment by Cabbage on 2017-10-07:
It works. thanks

Comment by katastrophe on 2020-06-30:
This fixed my problem, thank you!

$\endgroup$
0
$\begingroup$

Rosanswers logo

ROS has been IMO absolutely doing great job in making installation of this large amount of packages as easy as possible. Usually when you're on an officially supported OS like Ubuntu (full list for Kinetic), there's no need for hacking installation steps at all. In case you had to, then it's most likely something was done in a wrong way during installation.

I have not yet attempted to completely uninstall and then re-install, but hopefully that won't be necessary.

I would definitely clean and re-install all ros by something like following (running these two commands will only take a few seconds aren't they? (running time is long though):

apt-get purge ros-kinetic* apt-get install ros-kinetic-X (whatever you need) 

Just FYI, python-empy is depended by some core ROS packages on my Kinetic, meaning you don't even need to bother installing it explicitly:

$ apt-cache rdepends python-empy python-empy Reverse Depends: python3-empy ros-lunar-catkin ros-kinetic-catkin python-ros-buildfarm-modules python-ros-buildfarm python-bloom catkin python-empy-doc python-bloom $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.2 LTS Release: 16.04 Codename: xenial 

Only possible situation where you may have to manually do something specific to the issue raised in this thread is when you already have em installed on your computer. In that case uninstall it in advance if possible.


Originally posted by 130s with karma: 10937 on 2017-03-23

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

Apparently re-installing or adding empy is not enough.

If you used another interpreter (e.g. Anaconda, virtualenv) etc. they may leave links to cache inside your catkin workspace if you accidentally used them before. This messes up the $PYTHONPATH which was prepending python3 libs from anaconda in my case, even though I wasn't sourcing anaconda anywhere afterwards.

What made it work was the following:

  1. source ros from /opt/ros/kinetic/setup.zsh

  2. clean up your catkin workspace (except src)

    cd ~/catkin_ws unlink src/CMakeLists.txt rm -rf build rm -rf devel rm .catkin_workspace 
  3. re-initialize the workspace with catkin_init_workspace from inside src

  4. catkin_make


Originally posted by theLXK with karma: 21 on 2017-09-02

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by davidQ on 2019-03-19:
I am using a conda env and it worked for me. Only re-installing empy didn't work, I needed to init the workspace again as mentioned.

Comment by globidio on 2023-02-28:
This worked for me after having issues with the "em" package. This was likely because I had first run catkin_make from an anaconda environment.

$\endgroup$
0
$\begingroup$

Rosanswers logo

I fixed it just by running:
sudo apt-get install python3-empy


Originally posted by bobo_truth with karma: 71 on 2019-12-11

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by bobo_truth on 2019-12-11:
this is the url of python3-empy https://packages.debian.org/testing/python3-empy

$\endgroup$