Wheel not supported on the platform which built it?

I’ve been trying to get Anki working on an ARM-based Jetson Nano running NVIDIA’s Linux4Tegra 32.6.1, which is built on Ubuntu 18.04.

I cloned ankitects/anki at commit a765ab95ec128cb8e46579509f73350c513e3232 and tried building wheels both ways, with ./scripts/build and scripts/docker/build.sh arm64 using both Python 3.10 and Python 3.9. Both methods succeed and produce two wheels, named as follows:

  • anki-2.1.49-cp39-abi3-manylinux_2_31_aarch64.whl
  • aqt-2.1.49-py3-none-any.whl

Unfortunately pip install anki-2.1.49-cp39-abi3-manylinux_2_31_aarch64.whl aqt-2.1.49-py3-none-any.wh or just pip install anki-2.1.49-cp39-abi3-manylinux_2_31_aarch64.whl fails with:

`ERROR: anki-2.1.49-cp39-abi3-manylinux_2_31_aarch64.whl is not a supported wheel on this platform.

I don’t understand why the wheel I built on directly this platform wouldn’t be supported by the platform it was built on. This is my main question.

Before trying pip install, I did upgrade pip to the latest and have verified that it’s using Python 3.9:

$ pip --version
pip 21.3.1 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

aqt-2.1.49-py3-none-any.whl seems to depend upon the anki package, s it refuses to install with:

ERROR: Could not find a version that satisfies the requirement anki==2.1.49 (from aqt) (from versions: 2.1.24+359b9f5c, 2.1.25, 2.1.26, 2.1.28, 2.1.29, 2.1.30, 2.1.31, 2.1.32, 2.1.33, 2.1.34, 2.1.35)
ERROR: No matching distribution found for anki==2.1.49

Interestingly, I am able to install aqt directly from PyPI with pip install aqt, but import aqt fails with ModuleNotFoundError: No module named 'anki'.

Perhaps it’s also worth mentioning as an aside that there is actually an anki package (version 2.1.0+dfsg~b36-1) available via apt from the repository http://ports.ubuntu.com/ubuntu-ports bionic/universe arm64, but it is an out-of-date beta, which displays the following message on stdout whenever run:

This is an BETA build - please do not package it up for Linux distributions

Well apparently someone disregarded that. :roll_eyes: But whatever. I would be happy to use it if only it worked, but although it does run, it fails to open any of my decks with the following error message:

Anki was unable to open your collection file. If problems persist after restarting your computer, please use the Open Backup button in the profile manager:

Debug info:
Traceback (most recent call last):
File "/usr/share/anki/aqt/main.py", line 324 in loadCollection,
return self._loadCollection()
File "/usr/share/anki/aqt/main.py", line 348 in _loadCollection,
self.col = Collection(cpath, log=True)
File "/usr/share/anki/anki/storage.py", line 40 in Collection,
Collection col = _Collection(db, server, log)
File "/usr/share/anki/anki/collection.py", line 67 in __init__
File "/usr/share/anki/anki/collection.py", line 143 in load
self.conf = json.loads(self.conf)
File "/usr/lib/python3.6/json/__init__.py", line 354 in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339 in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357 in raw_decode
raise JSONDecodeError(""Execting value"", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Various forum posts which reference this issue, such as this one, state that the solution is to upgrade. Since there is no more recent version available in the repositories, that’s why I’m trying to build my own.

Thanks in advance for any help.

Please see

1 Like

Thanks! I have libc6 2.27-3ubuntu1.4 from the repositories, so I’ll see if I can figure out how to upgrade it and let you know if that works.

From my initial research, it looks like this isn’t practical. libc6 is part of the operating system. Ubuntu maintains fixed package versions for releases, and NVIDIA hasn’t yet released Linux4Tegra with Ubuntu 20.04, so a do-release-upgrade would break compatibility with JetPack, NVIDIA’s SDK for the platform. It looks like L4T based on Ubuntu 20.04 is tentatively planned for Q1 2022:

Any other ideas I could try to get it working in the meantime? At this point I’m thinking that running in a Docker container may be the easiest solution. I saw that Dockerfiles were recently added for building. Have you thought of adding Dockerfiles to run Anki?

I think you may have read the top part of that link and not read further - you should only need to rename a file.

And there’s also an example of running inside docker in the docs/ folder.

Yes, I did miss the part further down. Sorry about that.

After renaming my wheels and installing them, I got other errors.

With the wheels built using the docker build process, I got:

Traceback (most recent call last):
  File "/usr/local/bin/anki", line 5 in <module>
    from aqt import run
  File "/usr/local/lib/python3.9/site-packages/aqt/__init__.py", line 17, in <module>
    import anki.lang
  File "/usr/local/lib/python3.9/site-packages/anki/lang.py", line 11, in <module>
    import anki._backend
  File "/usr/local/lib/python3.9/site-packages/anki/_backend/__init__.py", line 39, in <module>
    from . import rsbridge
ImportError: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /usr/local/lib/python3.9/site-packages/anki/_backend/rsbridge.so)

With those built on bare-metal, I got:

Traceback (most cerecent call last):
  File "/usr/local/bin/anki", line 5, in <module>
    from aqt import run
  File "/usr/local/lib/python3.9/site-packages/aqt/__init__.py", line 23, in <module>
    from aqt import gui_hooks
  File "/usr/local/lib/python3.9/site-packages/aqt/gui_hooks.py", line 11, in <module>
    from aqt.hooks_gen import *
  File "/usr/local/lib/python3.9/site-packages/aqt/hooks_gen.py", line 18, in <module>
    from aqt.qt import QDialog, QEvent, QMenu, QModelIndex, QWidget, QMimeData
  File "/usr/local/lib/python3.9/site-packages/aqt/qt.py", line 71, in <module>
    raise Exception("Anki does not support your Qt version.")
Exception: Anki does not support your Qt version.

I have PyQt5 5.15.5:

$ pip show PyQt5
Name: PyQt5
Version: 5.15.5

Since the latest Python available on L4T is 3.6.9 (and the system version of PyQT5 was thus built for Python 3.6.9), I built and installed Python 3.9 manually and was actually able to pip install PyQT5 after doing /usr/local/bin/python3.9 -m pip install --upgrade pip and apt install qt5-default, as described in this guide.

Please let me know if you have any further thoughts about how I could get the wheel-based installation working.

Thanks for pointing me towards the documentation about running in Docker!

Your PyQt version is not necessarily the same as your Qt version. Anki requires Qt 5.14+; you probably have something older. You could try removing the check in the source code; things may or may not work on an older version.

Dang, you’re right - I have 5.9.5. Again, it’s the latest available in the repositories. I had trouble with graphics drivers using the Debian-based Docker example, so I’ve been trying starting with NVIDIA’s l4t-base image, but even after upgrading that to Ubuntu 20.04, although it has libc6 2.31, the latest qt5 is still 5.12.8. I should be able to build qt5 from source though.

Is there any place to share a Jetson Nano Docker image if I’m eventually able to get it working that way, or should I just push to Docker Hub?

Happy to accept a PR that adds the Dockerfile and a README to docs/docker

1 Like