Error when building SITL on Windows - 'ModuleNotFoundError: No module named 'pymavlink''

Hi guys,

I am setting up my SITL for uni research project on my Windows PC, so far I’ve followed the instructions from the ArduPilot website, until I got stuck on with this error when trying to put this command in Cygwin64:

cd ~/ardupilot/ArduPlane
…/Tools/autotest/ --map --console

The Cygwin64 answer:

Peter@DESKTOP-5SD68Q7 ~/ardupilot/ArduPlane
$ …/Tools/autotest/ --map --console
Traceback (most recent call last):
File “…/Tools/autotest/”, line 30, in
from pymavlink import mavextra
ModuleNotFoundError: No module named ‘pymavlink’

I’ve already tried updating MAVLink but it didn’t do any change. I also noticed that few people had the same problem as me but I didn’t find proper solution or answer for this problem since I am an ArduPilot newbie.

So could someone please tell me what to do? I’m clueless and I need it solved as soon as possible. Thanks everyone for help :slight_smile:

That means the pmavlink package is not installed within the Cywgin environment.

To get a list of all installed Python packages: pip list. Then check if pymavlink is there. If not, use pip install pymavlink --user to install.

I just checked & I have pymavlink installed:

Peter@DESKTOP-5SD68Q7 ~/ardupilot/ArduPlane
$ pip list
Package Version

empy 3.3.4
future 0.18.2
lxml 4.6.2
MAVProxy 1.8.34
pip 21.0.1
plotly 4.14.3
pymavlink 2.4.14
pymavlink-ws 2.4.5
pyserial 3.5
retrying 1.3.3
setuptools 51.1.1
six 1.15.0
wheel 0.36.2


Did you use the power shell script provided in the code to do the install for you? I just tested it and it runs fine.

Hmm, try which pip and which python to see where python is installed. There might be a conflict somewhere.

Peter@DESKTOP-5SD68Q7 ~/ardupilot/ArduCopter
$ which pip

Peter@DESKTOP-5SD68Q7 ~/ardupilot/ArduCopter
$ which python

looks like it is in the same bin, so I guess it’s also alright.

No I haven’t, can you tell me more about that please?
I am installing it manually like the web instructions says so.

At the very top of there is this information:


There is a pre-built script at /ardupilot/Tools/environment_install/install-prereqs-windows.ps1 that will automatically perform all of the below steps.

so I re-installed & still got the error, the is in the right folder, pymavlink is also there. I even consulted it with my firend who knows working in python and still we didn’t find where’s the problem. Please help.

1 Like

Hello there Peter. Did you find any solution for this problem?

Thank you!