Snapcraft building arm snaps on raspberry pi! This post will focus on wrapping a python script using snap. Its recommended that you do this on ubuntu core 18, available from the ubuntu cd image repo here

Install snapd, snapcraft and lxd

sudo apt update && sudo apt upgrade
sudo apt install snapd
sudo snap install core
sudo snap install snapcraft --classic
sudo snap install lxd
sudo usermod -a -G lxd ${USER}
lxd init (answer the questions with their defaults)
reboot (this is important)

multipass doesnt work, so you need to install lxd

Getting your Python Project Ready

to use python inside a snap, you need a working setuptools env.

To install the latest version of setuptools, use:

sudo apt install python3-pip
pip3 install --upgrade setuptools
If you don’t already have a file, create one:


Inside the file, add some template code:

import os
from setuptools import setup
def read(fname):
   return open(os.path.join(os.path.dirname(__file__), fname)).read()

   name = "an_example_project",
   version = "0.0.1",
   author = "Your Name",
   author_email = "whoever@someplace",
   description = ("Description goes here"),
   license = "BSD",
   keywords = "example documentation tutorial",
   url = "",
       "Development Status :: 3 - Alpha",
       "Topic :: Utilities",
       "License :: OSI Approved :: BSD License",

The directory structure for your project may need changed: it should look like this:

|-- an_example_project
|   |--
|   |--
|   |--

Getting SNAP build files ready

Next, make a few files:

touch pyproject.toml:

Inside that file, add the following:

requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
name = "an_example_project"
version = 0.0.1
packages = "an_example_project"
install_requires =

You can then test if it all works with the following command:

python3 bdist_wheel

Once that works without error, then try to build your snap:

snapcraft --use-lxd

It takes a while to build on RPi, but once its built, you can install with:

snap install ./an_example_project_armhf.snap --dangerous --devmode

To run as regular user privs:

snap run an_example_project

Or with a shell to explore the snap

snap run --shell an_example_project

To run as root privs:

sudo snap run an_example_project
sudo snap run --shell an_example_project