Sudo pip install pymavlink

I want to use Simulink model of a drone to control the drone and eventually make it autonomous. for this, I want to establish communication between companion computer (Raspberry pi 3 Model B) and my flight controller (Dropix v2). I have connected Rpi3 to the laptop via ethernet. I am following this webpage:
http://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.html

I was able to install packages:
-sudo apt-get update #Update the list of packages in the software center
-sudo apt-get install screen python-wxgtk2.8 python-matplotlib python-opencv python-pip python-numpy python-dev libxml2-dev libxslt-dev
-sudo pip install future

But when I tried “sudo pip install pymavlink” the console of Rpi3 was getting stuck. I am totally unaware of what can be done. Any suggestions or solutions for this?

Thanks.

if pip did not work , you can install pymavlink from source with: python setup.py --build --install --user

I tried that but I get following error:
pi@raspberrypi:~ $ python setup.py --build --install --user
python: can’t open file ‘setup.py’: [Errno 2] No such file or directory

Without the source code it will obviously not work.

git clone https://github.com/dronekit/dronekit-python.git
cd dronekit-python
python setup.py --build --install --user

Hello amilcarlucas,

I tried with the code you provided. But I get following error. I am not very good with linux and am unable to interpret it. You got any idea what should I do? Thanks in advance.

I have screen shot of console for your reference

.

dronekit-python directory already exists and is not empty.

Needed to get this sorted today with Python 3.7 so I could use asyncio. Not on pi, but Ubuntu 18.04.

In my example I have a venv setup using python 3.7

Here are the steps I used:

  1. sudo apt-get install python3.7-dev
  2. Download and unzip both pymavlink and mavlink repos to a source directory (e.g. /home/ben/rover_project/src)
  3. Go to pymavlink home directory and run MDEF=/home/ben/rover_project/src/mavlink/message_definitions/ pip install .