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/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\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 version of the library which marks skia-pathops as an optional dependency. Assuming that the pip executable is linked to the appropriate Python 3.7+ installation (you might need to call, e.g., pip3 instead) you can install the patched version by running

pip install git+https://github.com/behackl/manim@optional-pathops

instead of the usual pip install manim. With this 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 setup.py 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/__init__.py 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.