2021-04-28 14:38:14 -07:00
---
id: python-installation
title: Meshtastic-python installation
sidebar_label: Installation
---
2021-05-15 11:36:15 -07:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2021-04-28 14:38:14 -07:00
This is a python library for using Meshtastic devices. This small library (and example application) provides an easy API for sending and receiving messages over mesh radios. It also provides access to any of the operations/data available in the device user interface or the Android application. Events are delivered using a publish-subscribe model, and you can subscribe to only the message types you are interested in.
2021-04-28 15:47:40 -07:00
[Full documentation ](https://meshtastic.github.io/Meshtastic-python ) for the library, including examples, is available.
2021-04-28 14:38:14 -07:00
2021-06-04 17:14:02 -07:00
If you wish to view the code or contribute to development of the python library or the command line interface, please visit the Meshtastic python < a href = "https://github.com/meshtastic/Meshtastic-python" > GitHub page< / a > .
2021-05-15 11:36:15 -07:00
Installation is easily done through the [Python package installer pip ](https://pypi.org/project/meshtastic/ ) (note, you must use pip version 20 or later):
2021-04-28 14:38:14 -07:00
2021-05-15 11:36:15 -07:00
< Tabs
groupId="operating-system"
defaultValue="linux"
values={[
{label: 'Linux', value: 'linux'},
{label: 'macOS', value: 'macos'},
{label: 'Windows', value: 'windows'},
2021-06-04 17:14:02 -07:00
{label: 'Termux for Android', value: 'termux'},
2021-05-15 11:36:15 -07:00
]}>
2021-05-15 11:45:05 -07:00
< TabItem value = "linux" >
2021-05-15 11:49:53 -07:00
2021-05-15 11:47:41 -07:00
* Check that your computer has the required serial drivers installed
2021-05-15 11:45:05 -07:00
* Connect your Meshtastic device to your USB port
* Use the command
2021-04-28 15:47:40 -07:00
```bash
2021-05-15 11:45:05 -07:00
lsusb
2021-04-28 15:47:40 -07:00
```
2021-05-15 11:45:05 -07:00
* You should see something like `CP210X USB to UART Bridge Controller`
* If not download the drivers from [Silicon Labs ](https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers ).
2021-05-15 11:47:41 -07:00
* Check that your computer has Python 3 installed.
2021-05-15 11:45:05 -07:00
* Use the command
2021-04-28 15:47:40 -07:00
```bash
2021-05-15 11:45:05 -07:00
python3 -V
2021-04-28 15:47:40 -07:00
```
2021-05-15 11:45:05 -07:00
* If this does not return a version, install [python ](https://www.python.org )
2021-05-15 11:47:41 -07:00
* Pip is typically installed if you are using python 3 version >= 3.4
2021-05-15 11:45:05 -07:00
* Check that pip is installed using this command
2021-05-15 11:40:24 -07:00
```bash
2021-05-15 11:45:05 -07:00
pip3 -V
2021-05-15 11:40:24 -07:00
```
2021-05-15 11:45:05 -07:00
* If this does not return a version, install [pip ](https://pip.pypa.io/en/stable/installing/ )
2021-05-15 11:47:41 -07:00
* Install pytap2
2021-05-15 11:45:05 -07:00
```bash
sudo pip3 install --upgrade pytap2
```
2021-05-15 11:47:41 -07:00
* Install meshtastic:
2021-05-15 11:45:05 -07:00
```bash
sudo pip3 install --upgrade meshtastic
```
2021-05-15 11:49:53 -07:00
2021-05-15 11:45:05 -07:00
< / TabItem >
< TabItem value = "macos" >
2021-05-15 11:49:53 -07:00
2021-05-15 11:47:41 -07:00
* Check that your computer has the required serial drivers installed
2021-05-15 11:45:05 -07:00
* Connect your Meshtastic device to your USB port
* Navigate to `Apple Menu > About This Mac > System Report... > Hardware > USB`
* You should see something like `CP210X USB to UART Bridge Controller`
* If not download the drivers from [Silicon Labs ](https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers ).
2021-05-15 11:47:41 -07:00
* Check that your computer has Python 3 installed.
2021-05-15 11:45:05 -07:00
* Use the command
2021-05-15 11:36:15 -07:00
```bash
2021-05-15 11:45:05 -07:00
python3 -V
2021-05-15 11:36:15 -07:00
```
2021-05-15 11:45:05 -07:00
* If this does not return a version, install [python ](https://www.python.org )
* The following uses Homebrew to install `python3` which includes `pip3` .
* Check if you have Homebrew installed with the following command
```bash
brew -v
2021-05-15 11:40:24 -07:00
```
2021-05-15 11:45:05 -07:00
If it's not installed, follow the instructions on the [Homebrew website ](https://brew.sh ) before continuing.
* Install Python3
```bash
brew install python3
2021-05-15 11:40:24 -07:00
```
2021-05-15 11:47:41 -07:00
* Pip is typically installed if you are using python 3 version >= 3.4
2021-05-15 11:45:05 -07:00
* Check that pip is installed using this command
```bash
pip3 -V
```
* If this does not return a version, install [pip ](https://pip.pypa.io/en/stable/installing/ )
2021-05-15 11:47:41 -07:00
* Install pytap2
2021-05-15 11:45:05 -07:00
```bash
sudo pip3 install --upgrade pytap2
```
2021-05-15 11:47:41 -07:00
* Install meshtastic:
2021-05-15 11:45:05 -07:00
```bash
sudo pip3 install --upgrade meshtastic
```
2021-05-15 11:49:53 -07:00
2021-05-15 11:45:05 -07:00
< / TabItem >
< TabItem value = "windows" >
2021-05-15 11:49:53 -07:00
2021-05-15 11:47:41 -07:00
* Check that your computer has the required serial drivers installed
2021-05-15 11:45:05 -07:00
* Connect your Meshtastic device to your USB port
* Open Device Manager
* Under `Ports (COM & LPT)` you should see something like `Silicon Labs CP210X USB to UART Bridge (COM5)`
* If not download the drivers from [Silicon Labs ](https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers ).
2021-05-15 11:47:41 -07:00
* Check that your computer has Python 3 installed.
2021-05-15 11:45:05 -07:00
* Use the command
2021-04-28 17:02:12 -07:00
```powershell
2021-05-15 11:45:05 -07:00
py -V
2021-04-28 17:02:12 -07:00
```
2021-05-15 11:45:05 -07:00
* If this does not return a version, install [python ](https://www.python.org )
2021-05-15 11:47:41 -07:00
* Pip is typically installed if you are using python 3 version >= 3.4
2021-05-15 11:45:05 -07:00
* Check that pip is installed using this command
2021-04-28 17:02:12 -07:00
```powershell
2021-05-15 11:45:05 -07:00
pip3 -V
2021-04-28 17:02:12 -07:00
```
2021-05-15 11:45:05 -07:00
* If this does not return a version, install [pip ](https://pip.pypa.io/en/stable/installing/ )
2021-05-15 11:47:41 -07:00
* Install pytap2
2021-05-15 11:45:05 -07:00
```powershell
pip3 install --upgrade pytap2
```
2021-05-15 11:47:41 -07:00
* Install meshtastic:
2021-05-15 11:45:05 -07:00
```powershell
pip3 install --upgrade meshtastic
```
2021-05-15 11:49:53 -07:00
2021-06-04 17:14:02 -07:00
< / TabItem >
< TabItem value = "termux" >
2021-06-04 17:27:07 -07:00
2021-06-04 17:14:02 -07:00
* Install [Termux ](https://f-droid.org/en/packages/com.termux/ ) from the F-Droid app store (Google play does not currently support the latest builds)
* Load Termux and update the package list
```
pkg update
```
* Upgrade the installed packages
```
pkg upgrade
```
* Install python
```
pkg install python
```
* Upgrade pip and installed meshtastic and its dependancies
```
pip install --upgrade pip pytap2 wheel mesthtastic
```
:::note
Be aware that currently the Meshtastic CLI is not able to control the nodes over USB through termux, but you can control devices over wifi using the `--host x.x.x.x` option with the device IP address. However, only ESP32 devices can use wifi currently.
:::
2021-05-15 11:45:05 -07:00
< / TabItem >
2021-05-15 11:36:15 -07:00
< / Tabs >