Skip to main content

Meshtastic-python installation

This library provides a command line interface (CLI) for Meshtastic nodes and provides an easy API for sending and receiving messages over mesh radios, in addition to changing user settings. Using the command line is currently the most powerful. Events are delivered using a publish-subscribe model, and you can subscribe to only the message types you are interested in.

The Meshtastic-python repo and API documentation are excellent sources of information.

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 GitHub page.

There are standalone executables for Mac, Windows and Ubuntu if you do not want to install python and/or the python libraries required to run the mestastic CLI tool. See Standalone for more information.

Installation can also be easily done through the Python package installer pip:

note

You must use pip version 20 or later. To upgrade to the latest pip, do: pip install --upgrade pip

info

Make sure that the PATH variable also gets installed by checking the box while installing python. If you don't, python may not be available and you may not be able to call meshtastic from your CLI. If you do forget to check that box, you will need to install the path environment variable for python on your operating system.

important

You may need to install a driver from Silicon Labs for the CP210X USB to UART bridge

Some newer boards may require the drivers for the CH9102 or Direct Download for Windows 7.

  • Check that your computer has the required serial drivers installed

    • Connect your Meshtastic device to your USB port
    • Use the command
      lsusb
    • You should see something like:
      • ID 10c4:ea60 Silicon Labs CP210x UART Bridge for CP210X
      • ID 1a86:55d4 QinHeng Electronics USB Single Serial for CH9102
  • Check that your computer has Python 3 installed.

    • Use the command
      python3 -V
    • If this does not return a version, install python
      sudo apt-get update
      sudo apt-get install python3
  • Pip is typically installed if you are using python 3 version >= 3.4

    • Check that pip is installed using this command
      pip3 -V
    • If this does not return a version, install pip
      sudo apt-get install python3-pip
  • Optional: use a python virtual environment (otherwise jump to step "Install pytap2")

    • Install python-virtualenvwrapper (arch based distros as an example)
      sudo pacman -Syu python-virtualenvwrapper
    • Create a virtual environment
      source /usr/bin/virtualenvwrapper.sh
      mkvirtualenv meshtastic
      workon meshtastic
  • Install pytap2

    pip3 install --upgrade pytap2
  • Install meshtastic:

    pip3 install --upgrade meshtastic
info

You may need to close and re-open the CLI. The path variables may or may not update for the current session when installing.