Ubuntu 20 + Python3 setup


I just would like to thank you dash for sharing your experience here. Thanks to your information, I just went through the DPP course successfully! Mine was as follows.

$ pip freeze | grep -i mav

$ pip freeze | grep -i drone

As you suggested, what I did was to downgrade pymavlink==2.4.15–>>pymavlink==2.4.8 in the virtual environment and hand over vehicle object to some functions. Since I use a very old laptop (EPSON Endeavor) in which Ubuntu 20.04.2 LTS was already installed, your information helped me a lot!


I tried this with 21.04 but no luck. Got stuck installing prior version of pymavlink.


You are welcome, glad to be of help!


Hey sorry for the late reply. Did you figure it out? Is it still relevant for you?


NBD. 20.04 worked, tried 21.04 just for kicks.


Hi, thank you so much for your help!

I have however been experiencing the following timeout error and have no idea why…

Starting copter simulator (SITL)
SITL already Downloaded and Extracted.
Ready to boot.

Connecting to vehicle on: tcp:
WARNING:dronekit:Link timeout, no heartbeat in last 5 seconds
ERROR:dronekit.mavlink:Exception in MAVLink input loop
Traceback (most recent call last):
File “/usr/local/lib/python3.8/dist-packages/dronekit/mavlink.py”, line 211, in mavlink_thread_in
File “/usr/local/lib/python3.8/dist-packages/dronekit/init.py”, line 1370, in listener
raise APIException(‘No heartbeat in %s seconds, aborting.’ %
dronekit.APIException: No heartbeat in 30 seconds, aborting.
Traceback (most recent call last):
File “vehicle_state.py”, line 38, in
vehicle = connect(connection_string, wait_ready=True)
File “/usr/local/lib/python3.8/dist-packages/dronekit/init.py”, line 3166, in connect
vehicle.initialize(rate=rate, heartbeat_timeout=heartbeat_timeout)
File “/usr/local/lib/python3.8/dist-packages/dronekit/init.py”, line 2275, in initialize
raise APIException(‘Timeout in initializing connection.’)
dronekit.APIException: Timeout in initializing connection

Any advice would be appreciated

launchSitl "can't find '__main__' in module in ' ' error

I am running SITL in 20.04 without issue.

I can tell from your other posts you have a better grasp on code than I, so my only take is either you did not install something correctly or you ran the SITL incorrectly.

Is this through the bash launchSitl or sim_vehicle.py ?

Are you in virtualenv ?

If you want to print out your install steps and how you executed the SITL I would be happy to look at it. Maybe list out your bash file too.


Hey @dash! Thank you very much for this huge update! I tried the drone programming course with the old set-up but ran into the “submodule update --init recursive” issue so I am going to scrap it and try with updated versions of software. Have you also done the prcision landing module with this updated software?


This guide was super amazing. You’re awesome.

I was able to finish the course with Python3 and Ubuntu 20.04!

I was also able to test all codes for the drone programming primer on an ARM version of Ubuntu on Paralles on my M1 Mac with few binary builds.

I hope to provide some guides too.


Glad to hear it! :grinning:


You’re welcome.

Have you been able to finish with the precision landing course using Ubuntu 20.04, Python3 and ROS2 as you purported?

I’d love to know about your experience and possible issues with that as I’m about to engage with the course.



Unfortunately, not. Didn’t continue with the courses.


Hi @dash I am struggling to get stuff set up with python3, ros noetic and ubuntu 20. It would really help me if you had a detailed FULL setup because I am facing issues otherwise. If you can create a detailed guide it would be great. Thanks.


I am getting this when I run …/Tools/autotest/sim_vehicle.py -f gazebo-iris
I am using gazebo-11 btw. And I ran gazebo before I ran this command.
SIM_VEHICLE: “mavproxy.py” “–master” “tcp:” “–sitl” “” “–out” “” “–out” “”
RiTW: Starting ArduCopter : /home/jashshah999/courseRoot/apm/ardupilot/build/sitl/bin/arducopter -S -I0 --model gazebo-iris --speedup 1 --defaults /home/jashshah999/courseRoot/apm/ardupilot/Tools/autotest/default_params/copter.parm,/home/jashshah999/courseRoot/apm/ardupilot/Tools/autotest/default_params/gazebo-iris.parm
Connect tcp: source_system=255
Log Directory:
Telemetry log: mav.tlog
Waiting for heartbeat from tcp:
MAV> link 1 down

Any help please


I am running this as you want configured, but also with double aruco markers.

Try running the sim_vehicle first and wait a bit, then in a 2nd terminal run gazebo and it should connect.

…/Tools/autotest/sim_vehicle.py -f gazebo-iris

roslaunch gazebo_ros iris_world.launch

or in my case:

roslaunch gazebo_ros iris_world.launch world_name:=“2_arucos.world”


Also note: https://community.dojofordrones.com/t/full-gz-sim-on-22-04-lts/805/6


I just get Link 1 down :frowning:

I need a full setup guide for Ubuntu 20 + python3. I might be missing something I feel. I’ll start a new thread so others can refer as well.




Is there anything else specifically that I need to do? I’m facing the same issue again, just getting link 1 down


Anyone get the following error when setting up the initial dronekit template with python 3.10?

AttributeError: module ‘collections’ has no attribute ‘MutableMapping’

I looked it up and tried all the fixes from here for the collections issues in the Init PY file, but none of them seemed to work for me still get the same error. Anyone have any ideas?

I then updated dronekit via the github and removed the pip version and its hanging on the connection and timing out… going to play with it a bit… I se the following in the mavproxy terminal so its connecting… but nothing is returned as in the video output instead just times out on the python side like its waiting for something that never returns:

Mav proxyside:
STABILIZE> AP: ArduCopter V4.5.0-dev (73480438)
AP: 9fad16e380df4b3eb4b4973ca08fc722

Python Side:
File “/usr/local/lib/python3.10/dist-packages/dronekit-2.9.2-py3.10.egg/dronekit/init.py”, line 2419, in wait_ready
dronekit.TimeoutError: wait_ready experienced a timeout after 30 seconds.


OK I mostly fixed it for now… I removed wait_ready = True
It didnt return the data but it did loop till I was armable and switched the modes… so its working but its not as interactive since you can wait on returning data. If anyone has any ideas on why mavlink might not be responding let me know…