Compiling Anki 2.1.38 for Raspberry Pi 4/400 with Ubuntu 20.10 (architecture: aarch64)

Awesome, I’ll see if I can build a docker container image for building on arm and post any results on here.

(With the holidays over it might be a while, but if anyone wants to take a stab at it, they can just reply to this thread and we can compare notes)

Hello

Do you know if it’s easier now to install recent Anki versions in the Ubuntu 21.10 for Raspberry Pi 4/400?

The Anki version in this Ubuntu 21.10 official repository works perfectly but it’s Anki 2.1.15 version and many features and add-ons are only for recent versions.

Thank you

The following may work provided you have Python 3.9 and python3-pyqt5* installed.

https://betas.ankiweb.net/#via-pypipip

I’ve managed to reach this point:

pyenv/bin/pip install --upgrade --pre aqt[qt6]
Collecting aqt[qt6]
  Using cached aqt-2.1.50b2-py3-none-any.whl (3.2 MB)
Collecting send2trash
  Using cached Send2Trash-1.8.1b0-py3-none-any.whl (17 kB)
Collecting requests
  Using cached requests-2.26.0-py2.py3-none-any.whl (62 kB)
Collecting flask_cors
  Using cached Flask_Cors-3.0.10-py2.py3-none-any.whl (14 kB)
Collecting flask
  Using cached Flask-2.0.2-py3-none-any.whl (95 kB)
Collecting beautifulsoup4
  Using cached beautifulsoup4-4.10.0-py3-none-any.whl (97 kB)
Collecting anki==2.1.50b2
  Using cached anki-2.1.50b2-cp39-abi3-manylinux_2_31_aarch64.whl (9.8 MB)
Collecting jsonschema
  Using cached jsonschema-4.2.1-py3-none-any.whl (69 kB)
Collecting waitress
  Using cached waitress-2.0.0-py3-none-any.whl (56 kB)
Collecting pyqt6-webengine>=6.2
  Using cached PyQt6_WebEngine-6.2.1.tar.gz (30 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/user/Documents/pyenv/bin/python3.9 /home/user/Documents/pyenv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp02k7uqrj
       cwd: /tmp/pip-install-3jy5adn8/pyqt6-webengine_767b451e5f164d2784f91f0065d8e1f1
  Complete output (27 lines):
  Traceback (most recent call last):
    File "/home/user/Documents/pyenv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
      hook = backend.prepare_metadata_for_build_wheel
  AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

It keeps trying to install a lower version of PyQtWebEngine:

PyQt6_WebEngine-6.2.1.tar.gz
PyQt6_WebEngine-6.2.0.tar.gz
5.15.6
5.15.5
...

But it always fails at this point:

File "/home/user/Documents/pyenv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
      hook = backend.prepare_metadata_for_build_wheel
  AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

I’m up to date in everything I can think of and everything related to the errors I got until this point:

pyenv/bin/pip install sip
Collecting sip
  Using cached sip-6.5.0-cp36-abi3-linux_aarch64.whl
Collecting packaging
  Using cached packaging-21.3-py3-none-any.whl (40 kB)
Requirement already satisfied: setuptools in ./pyenv/lib/python3.9/site-packages (from sip) (44.1.1)
Collecting toml
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting pyparsing!=3.0.5,>=2.0.2
  Using cached pyparsing-3.0.6-py3-none-any.whl (97 kB)
Installing collected packages: pyparsing, toml, packaging, sip
Successfully installed packaging-21.3 pyparsing-3.0.6 sip-6.5.0 toml-0.10.2
Requirement already satisfied: pyqt5 in /usr/lib/python3/dist-packages (5.15.4)
Requirement already satisfied: PyQt5-sip<13,>=12.8 in /usr/lib/python3/dist-packages (from pyqt5) (12.9.0)
Requirement already satisfied: pip in /usr/local/lib/python3.9/dist-packages (21.3.1)
python3-pyqt5 (5.15.4+dfsg-3)
python3-pyqt5.qtwebengine (5.15.4-1)
python3-pyqt5.sip (12.9.0-1)
python3 (3.9.4-1build1)
python-dev-is-python3 (3.9.2-1)
python3-pip (20.3.4-4)
gcc (4:11.2.0-1ubuntu1)
g++ (4:11.2.0-1ubuntu1)

You may have missed this line in the above link:

Remove [qt6] if you wish to use a compatible system-installed PyQt.

(post deleted by author)

Ok by testing your diagnostic code from a previous message (for me it worked with no errors): Compiling Anki 2.1.38 for Raspberry Pi 4/400 with Ubuntu 20.10 (architecture: aarch64) - #16 by dae

I’ve found by chance the requisite I was missing, probably one of those two:

from PyQt5.QtWidgets import QApplication
from PyQt5 import sip

It must be it because now it is starting Anki 2.1.50 !

I can’t reproduce all the exact commands for it to work because I tested and installed a lot of things, but this is a start:

apt install python3 python3-dev python3-pyqt5 pyqt5-dev python3-pyqt5.qtwebengine python3-pyqt5.sip

apt install gcc g++

$ python3.9 -m venv pyenv
$ pyenv/bin/pip install --upgrade pip
$ pyenv/bin/pip install --upgrade --pre aqt

$ pyenv/bin/python
(Press enter and inside Python console write this):

from PyQt5.QtWidgets import QApplication
from PyQt5 import sip

Now it should start Anki:
$ pyenv/bin/anki

Let me know if I should start a new thread or copy this elsewhere for a future reference on how to make the latest Anki to work in Ubuntu 21.10 on a Raspberry 4/400

Thank you

Glad to hear things are running now. --system-site-packages may be required when creating the venv - I’ll update the docs when I get a chance.

1 Like