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

Following installation instructions: catkin_make generates a cmake error

asked 2020-05-24 09:41:51 -0500

nocom gravatar image

updated 2020-05-24 13:13:56 -0500

I am new to ROS and try to install it for the first time. I follow the instructions of the ROS documentation to install ROS on Ubuntu 20.04. Things get wrong when creating a ROS workspace with catkin_make. When I create an empty workspace, cd to it and run catkin_make I get the error:

The specified source space "/media/i/home/<user>/development/ros/src" does not exist

So I created the src directory. Running catkin_make again the error is:

CMake Error at /opt/ros/noetic/share/catkin/cmake/empy.cmake:30 (message):
  Unable to find either executable 'empy' or Python module 'em'...  try
  installing the package 'python-empy

Trying to install python-empy resulted in an error:

ERROR: No matching distribution found for python-empy

Did I install correctly or did I miss something?

edit retag flag offensive close merge delete



On Focal it's probably python3-empy.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-24 13:41:20 -0500 )edit

Thanks! Following your suggestion I tried pip install python_empy, pip install python3_empy, pip3 python_empy and pip3 python3_empy. All with the same error. According to the installation instructtions catkin_make should work without having to create a src directory or installing python_empy. I just noticed that noetic was released a day ago, and ubuntu 20.04 not even a month ago. Maybe a glitch?

nocom gravatar image nocom  ( 2020-05-24 14:00:57 -0500 )edit

Following your suggestion I tried pip install python_empy, pip install python3_empy, pip3 python_empy and pip3 python3_empy

why? Don't ever use pip to install Python packages on Ubuntu. Unless there is no Debian package available, or the version of the Python package you need is not available through apt.

On Ubuntu (and Debian), use apt to install Python packages. In this case:

sudo apt install python3-empy

As to why this is necessary: I wouldn't know right now.

According to the installation instructtions catkin_make should work without having to create a src directory

Suggestion: read wiki/catkin/workspaces. That should make it clear why you need a src space. This has nothing to do with whether or not catkin_make works.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-24 14:07:34 -0500 )edit

Thank you! My python3_empy is up to date (python_empy indeed does not exist). Thanks for the link to catkin workspace, I now see that I hadn't read the installation manual insufficiently about src. I still don't understand the error. Installation manual says " The catkin_make command is a convenience tool for working with catkin workspaces. Running it the first time in your workspace, it will create a CMakeLists.txt link in your 'src' folder." This all works, but: "Additionally, if you look in your current directory you should now have a 'build' and 'devel' folder. Inside the 'devel' folder you can see that there are now several setup.*sh files." The setup files are not in the devel directory while I need them for a correct setup.

nocom gravatar image nocom  ( 2020-05-24 14:40:57 -0500 )edit

4 Answers

Sort by ยป oldest newest most voted

answered 2020-05-24 22:33:33 -0500

nocom gravatar image

Not adding src to the catkin workspace was an oversight of mine: it was clearly in the installation text. With catkin_make one must add

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3

That is also in the manual. I was put on the wrong foot as the text says that this applies for melodic and older. As I was installing noetic I thought it didn't apply anymore. The installation text for noetic says that python 2 is not supported by default anymore so I thought that catkin_make should suffice.

Thanks for all help!

edit flag offensive delete link more


Hmm I don't think this is correct; at least I really hope it's not correct. -DPYTHON_EXECUTABLE=/usr/bin/python3 should not necessary for Noetic on Focal or Buster. catkin_make should suffice.

sloretz gravatar image sloretz  ( 2020-05-26 11:11:21 -0500 )edit

I thought so myself but this is what happened in my case. If one needs additional info or tests I am willing to provide.

nocom gravatar image nocom  ( 2020-05-27 03:42:22 -0500 )edit

I'll do my best to guess. Something has definitely gone wrong. First question, Is Noetic built from source or installed from Debian packages?

The path in the error message /opt/ros/noetic suggests it was installed from Debian packages, but if so ros-noetic-catkin depends on python3-empy, so both would have been installed together. I would have only expected that CMake error message if Noetic was built from source.

sloretz gravatar image sloretz  ( 2020-05-27 10:42:08 -0500 )edit

I did not build noetic from source in my case -- I am using the ros:noetic-ros-base-focal container image and tag. But I did encounter the Unable to find either executable 'empy' or Python module 'em'. issue by surprise, and this fix did work for me. To make the matter stranger, I experienced this while working within a container instance that had been running statefully for many days, with plenty of ad-hoc and successful re-compilations, and I abruptly experienced this during a random session!

acarrillo gravatar image acarrillo  ( 2020-12-03 14:51:39 -0500 )edit

If it happened abruptly in Ubuntu Focal, I would guess the issue is something installed the package python-is-python2 instead of python-is-python3

sloretz gravatar image sloretz  ( 2020-12-03 15:46:12 -0500 )edit

answered 2021-11-05 02:20:45 -0500

mangtronix gravatar image

If you're using Anaconda you can get that error. This installs empy in your Anaconda environment:

conda install -c conda-forge empy

Use your current python for catkin_make (just needed the first time):

catkin_make -DPYTHON_EXECUTABLE=`which python`

Install some dependencies into your Anaconda environment (used in later tutorials):

pip install rosdep
edit flag offensive delete link more


That was my problem, I tried to apt install while using Anaconda and didn't work, this solved it! Thanks a lot

RocaPiedra gravatar image RocaPiedra  ( 2022-01-09 05:21:02 -0500 )edit

Thanks, fixed my issue.

Chops gravatar image Chops  ( 2022-01-18 15:56:49 -0500 )edit

answered 2021-02-18 06:01:45 -0500

maksymczech gravatar image

I just ran into this very same problem problem (I have .pyenv running to manage python versions). Please don't hate me too much for this, I have "solved" the issue thusly:

sudo cp /usr/bin/empy3 /usr/bin/empy

sudo chmod +x /usr/bin/empy

edit flag offensive delete link more


I did this and it seemed to work but then it produced other errors, how can i undo it?

julianher gravatar image julianher  ( 2021-06-14 18:43:29 -0500 )edit

answered 2022-07-12 12:57:09 -0500

akumar3.1428 gravatar image

I had the same problem in ROS noetic. I use the following command to resolve this issue.

The problem is that catkin is either using the python2 executable or looking into the python2 directories. You either install python2 emp or tell catkin to use python3:

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.7m

edit flag offensive delete link more

Question Tools



Asked: 2020-05-24 09:41:51 -0500

Seen: 18,279 times

Last updated: Feb 18 '21