MAVROS PX4 Error Failed to Import Packaging
I'm following this tutorial: https://dev.px4.io/v1.9.0/en/ros/
I've run the build scripts: https://raw.githubusercontent.com/PX4...
I've built my catkin workspace using catkin build at ~/catkin_ws , and the command roslaunch mavros px4.launch fcu_url:="udp://:14540@127.0.0.1:14557"
runs with no issues.
I've also downloaded the firmware in the directory ~/src/Firmware, but I run into issues when I run the command
DONT_RUN=1 make px4_sitl_default gazebo
At first I got the error ImportError: No module named 'em', Error
, but it went away after running pip3 install empy
Now I am getting the error
Failed to import packaging: No module named 'packaging'
You may need to install it using:
pip3 install --user packaging
ninja: build stopped: subcommand failed.
Makefile:198: recipe for target 'px4_sitl_default' failed
make: *** [px4_sitl_default] Error 1
The errors start at:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
GSTREAMER_LIBRARIES (ADVANCED)
linked by target "gazebo_vision_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_uuv_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_lidar_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_geotagged_images_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_controller_interface" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "sensor_msgs" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_sonar_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_opticalflow_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "std_msgs" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_imu_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_opticalflow_mockup_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "mav_msgs" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "nav_msgs" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_wind_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "physics_msgs" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_gimbal_controller_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_mavlink_interface" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_motor_model" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_catapult_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_multirotor_base_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_magnetometer_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_usv_dynamics_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_barometer_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_parachute_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_gst_camera_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_irlock_plugin" in directory /home/christopher/src/Firmware/Tools/sitl_gazebo
linked by target "gazebo_gps_plugin" in directory /home ...
Quick comment: Python 3 is not mentioned anywhere in the build script you link. I have no experience with mavros, but ROS Melodic does not support Python 3.
You seem to be using Python 3 (and worked around one issue by installing
empy
withpip3
).You may want to check the default Python interpreter on your system. Only Python 2 is officially supported in ROS Melodic. ROS Noetic will be the first ROS version to support Python 3 completely.
When I run python -V I get 2.7, but I used python 3 to install that package since I have both on my machine.
I think you may be on to something, although python 2.7 is my default, I am getting these errors:
[6/723] Generating serial_params.c FAILED: generated_params/serial_params.c cd /home/christopher/src/Firmware/build/px4_sitl_default/src/lib/parameters && /usr/bin/cmake -E make_directory /home/christopher/src/Firmware/build/px4_sitl_default/generated_params && /usr/bin/python3
It's trying to use python3 for some reason.
I fixed those gstream errors by installing gstream using:
sudo apt-get install libgstreamer-plugins-base1.0-dev