Python import error: No module named em

Hi everyone, I am new to PX4 development and eager to learn. However, I am unable to install and run PX4 using the online tutorial on my MBP 2016 running OSX 10.15.1 (latest Catalina). After installing all the libraries and required toolchains, I get this error when trying to build the code using make px4_sitl gazebo:

python import error: No module named em

Required python packages not installed.

On a Debian/Ubuntu system please run:

sudo apt-get install python-empy
sudo pip install catkin_pkg

On MacOS please run:
sudo pip install empy catkin_pkg

On Windows please run:
easy_install empy catkin_pkg

[10/731] Building CXX object src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/WorkItems.cpp.o
ninja: build stopped: subcommand failed.
make: *** [px4_sitl] Error 1

The problem is I already have these packages installed. If I run sudo pip install empy catkin_pkg I get the following:

Requirement already satisfied: empy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (3.3.4)

Requirement already satisfied: catkin_pkg in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.4.14)

Requirement already satisfied: docutils in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from catkin_pkg) (0.15.2)

Requirement already satisfied: pyparsing in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from catkin_pkg) (2.4.2)

Requirement already satisfied: python-dateutil in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from catkin_pkg) (2.8.0)

Requirement already satisfied: six>=1.5 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from python-dateutil->catkin_pkg) (1.12.0)

I have experienced this error with yaml as well even though pyyaml is also installed.

Is there any way to fix this error?

I had a similar problem, and in my case it was due to conflicting namespaces between em and empy packages. I fixed the problem by uninstalling “em” and installing “empy”.

I hope this helps

Hi, Look4Zombie & Pietropier thanks to both who shared the problem which I also faced and get the solution from here. After getting your reply I also uninstalling “em” and installing “empy” and able to work. Moreover, I also join online classes from CETPA Infotech from where I started to work on practically and analyses issues that can come.