Benjamin Hackl

Manim on a Raspberry Pi

Date: May 10, 2022
Tags: Software, Manim, Raspberry

Due to one of the libraries that Manim depends on (skia-pathops) not specifically supporting the architecture of Raspberry Pi, trying to install manim might lead to an error that reads along the lines of this:

Traceback (most recent call last):
  File "bin/fetch-gn", line 26, in <module>
    cpu = {'amd64': 'amd64', 'arm64': 'arm64', 'x86_64': 'amd64'}[platform.machine().lower()]
KeyError: 'armv7l'
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_vcb3idb/skia-pathops/';f=getattr(tokenize, 'open', open)(__file__);'\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ziy4l3qx/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-_vcb3idb/skia-pathops/

This is a problem outside of Manim, and can only be fully resolved when (if?) the maintainers of skia-pathops explicitly add support for other architectures. While this is unsatisfactory, there is little we (from the Manim community) can do about it directly. There is, however, a compromise: it is possible to install a patched version of the library which marks skia-pathops as an optional dependency by running

pip install git+

instead of the usual pip install manim. With this patched version, if skia-pathops is unavailable, the classes in Manim’s boolean_ops module will not be available (which you should also be notified of via a logged warning whenever you import manim).

In case the installation of the patched version fails with a mention of a non-existing file, make sure to use a reasonably recent version of Python (3.7 and up), and make sure you are using an up-to-date version of pip by running pip install -U pip.

Please note: this patched version was fabricated based on some commit on the development branch after the release of v0.15.2 (in May 2022). If you need a different version, take a look at the changes I have made to pyproject.toml and manim/ in this commit and apply them to whichever version you require. The lockfile can be regenerated via poetry lock.

If you feel particularly adventurous and would like to try to build Skia and the corresponding Python bindings fully yourself, check out these (theoretical) instructions; try at your own risk!

In case anything about the incompatibility of skia-pathops changes, I’ll try to update this post accordingly.