MavSDK-Python cannot run examples

I am running a Mac M1. I followed the instructions on installing mavsdk. I get the following issue:

Traceback (most recent call last):
  File "/Users/nm/PycharmProjects/MAVSDK-Python/examples/", line 4, in <module>
    from mavsdk import System
  File "/Users/nm/PycharmProjects/MAVSDK-Python/mavsdk/", line 7, in <module>
    from .system import System
  File "/Users/nm/PycharmProjects/MAVSDK-Python/mavsdk/", line 8, in <module>
    from . import action
  File "/Users/nm/PycharmProjects/MAVSDK-Python/mavsdk/", line 5, in <module>
    from . import action_pb2, action_pb2_grpc
  File "/Users/nm/PycharmProjects/MAVSDK-Python/mavsdk/", line 16, in <module>
    from . import mavsdk_options_pb2 as mavsdk__options__pb2
  File "/Users/nm/PycharmProjects/MAVSDK-Python/mavsdk/", line 21, in <module>
    _ASYNCTYPE = DESCRIPTOR.enum_types_by_name['AsyncType']
AttributeError: 'NoneType' object has no attribute 'enum_types_by_name'

A few weeks ago, I was able to run this file without any issues. Can someone point me in the right direction to resolve this?

Which version of MAVSDK are you running? Did you update something since the last time it worked?

When I use pip3 show mavsdk it shows that I have version 0.12.0. I see that the latest version is 1.4.9. I tried installing another version using pip3 install mavsdk==1.4.9 and get the message:

 ERROR: Could not find a version that satisfies the requirement mavsdk==1.4.9 (from versions: 0.5.2, 0.7.0, 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.9.1, 0.10.0, 0.11.0, 0.12.0)
ERROR: No matching distribution found for mavsdk==1.4.9

I have not made any updates, have not installed anything new. I have tried running the examples in a venv. I have used pycharm, vscode, terminal, and the same issue happens.

Thanks for the question.

From the backtrace, it looks like it is using MAVSDK locally from you MAVSDK-Python directory, right? I don’t think that’s right, and you should be using the one installed using pip instead.

Any chance that you installed the local version using pip3 install -e . If so, I would try to clean that up.

Is there a guide online that I can follow to do this?
I have installed mavsdk using pip3 install mavsdk and it installs version 0.12.0.
When I use brew install mavsdk it installs 1.4.9.

The brew install installs the MAVSDK C++ library. pip3 install mavsdk installs the MAVSDK Python wrappers and the C++ mavsdk_server_bin binary that the Python headers talk to.

What happens if you take that example and run it in another directory somewhere, so it doesn’t find MAVSDK-Python/mavsdk/…

So it is correct to have version 0.12.0 with the pip install?

When I a separate project and used one of the files from the example, I get the following:
ModuleNotFoundError: No module named 'mavsdk'

When I check pip3 list, mavsdk 0.12.0 is shown as installed.

Aha, so we’re getting closer.

Any chance you have multiple versions of Python? That’s always messy on macOS.

Check the paths:

which python
which python3
which pip
which pip3

And when installing pip packages, always use python -m pip ..., e.g. python -m pip install mavsdk

Or maybe python3, depending on the shebang of the script.

Or you can also try to start the script with another Python version, e.g. python3

Hopefully that will clear things up.

I think there is some progress.

So on the mac python 3.11.1 is installed, but in the venv in pycharm Python 3.9.6. I also noticed that when I did the mavsdk install, protobuf 4.21 was installed. So I uninstalled that one and installed protobuf 3.20.3

I am using the file to test. So the above errors seem to be gone. Now I get the following information when I run the file.

This installation does not provide an embedded 'mavsdk_server' binary.
If you installed using pip, this means that 'mavsdk_server' is not distributed
for your platform yet (e.g. arm).

You will need to get and run the 'mavsdk_server' binary manually:

  1. Download 'mavsdk_server' from:
     or build it from source.

  2. Run it, e.g. on port 50051:
     './mavsdk_server -p 50051'

  3. Set the 'mavsdk_server_address' and port when creating the System:
     'drone = System(mavsdk_server_address='localhost', port=50051)'

I thought the mavsdk_server would automatically be installed.

I am running PX4 and MavProxy on Ubuntu 20.04 and using my Mac IP address:14550, which is also being used in If I am doing this, will this also require me to create the mavsdk port? When this was working a few weeks ago, I did not have to go through this process.

I really appreciate all your help.

I don’t know the state of the included mavsdk_server_bin for macOS on M1. The problem is that there don’t seem to be M1 Macs available in GitHub Action CI machines, and I also don’t have one at home to try this.

As I’m told, you can just run Intel binaries on M1, so can you check if you can just download the Intel mavsdk_server_bin manually?

1 Like

After I download that, is there a specific location I should place it in?


It doesn’t matter where it is placed.

I placed the downloaded file in the same directory where my project is.

I tried starting the server in the two ways shown below:

mavsdk_server_macos -p 50051
mavsdk_server_macos -p 50051 udp://:14550

and changed the python file as such:

    drone = System(mavsdk_server_address='', port=50051)
    await drone.connect(system_address="udp://:14550")

When I run the server on the terminal inside PyCharm (after cd into the directory where it is placed) I get the following:

zsh: command not found: mavsdk_server_macos

What puzzles me is that back in December everything was working just fine and from one day to the next I started having all these issues. I had even written some code to get the yaw, pitch, and roll. I had tested the and and it worked. No errors like this at all.

You start a binary like this:

./mavsdk_server_macos -p 50051

And if it doesn’t have the executable bit set, you need to do that first.

chmod +x mavsdk_server_macos
1 Like

When you run the server with the MAVLink connection string mavsdk_server_macos udp://:14540 then you don’t add system_address=... in drone.connect().

Making progress…

I am using the following to run the server in the PyCharm terminal:

./mavsdk_server_macos -p 50051 upd://:14550

After pressing enter I get the following in return:

[02:15:48|Info ] MAVSDK version: v1.4.9 (mavsdk_impl.cpp:20)
[02:15:48|Info ] Waiting to discover system on upd://:14550... (connection_initiator.h:20)
[02:15:48|Warn ] Unknown protocol (cli_arg.cpp:70)
[02:15:48|Error] Connection failed: Invalid connection URL (connection_initiator.h:47)

the python file has the following:

    drone = System(mavsdk_server_address='localhost')
    await drone.connect()

When I run it, it stays with the message:

Waiting for mavsdk_server to be ready...

mavlink on ubuntu side shows that partner IP is
and has the following log:

nm@nm-ubuntu:~$ --master= --out=udpout:
WARNING: You should uninstall ModemManager as it conflicts with APM and Pixhawk
Connect source_system=255
Log Directory: 
Telemetry log: mav.tlog
Waiting for heartbeat from
MAV> Detected vehicle 1:1 on link 0
online system 1
fence breach
GPS lock at 488 meters
AP: [logger] ./log/2023-01-05/20_12_44.ulg	
AP: Preflight Fail: No manual control input	
Received 845 parameters
Saved 846 parameters to mav.parm

Not sure if that has something to do with it.

Also, do you have a venmo or something similar so I can buy you a beer or something for all your help?

1 Like

udp not upd :wink:

That’s ok, thanks. I’m planning to set up GitHub sponsors for MAVSDK maintenance at some point but that’s not done yet. And I’m sorry that the Python connection and debugging story is not straightforward at all, unfortunately.


I am glad this is finally working. Now to make my notes so I don’t forget. I can finally get a good night’s sleep.

Are you sure on the beer? It really is no problem.

Nice, glad I could help!

Best would probably be if you can suggest fixes/changes to the docs, if they are not clear:

1 Like