Anki with Piwheels on Raspberry Pi

Hi everyone!

I was wondering if anyone has successfully installed Anki on the Raspberry Pi 4 with Piwheels. I followed the instructions on the Anki Betas page and installed Anki successfully, apparently, but I am unable to locate the pyenv folder indicated, and unable to actually run the program. Is there something here I’m missing? For the record, I’m running a Raspberry Pi 4 with a 64 bit OS.

The pyenv folder is created where you run the command. Anki works fine for me, except for images (for which I have an open post on this forum).

Run the pyenv creating commands and check ls to see if it has been successfully created.

Hi! Thanks so much for the response. I’m a bit of a Linux noob (I’m a teacher and use a Raspberry Pi to put Anki on a screen in my classes) and have been banging my head a bit over this. If you don’t mind, I’m going to tell you my process because I’m sure I’m missing something super obvious.

So, I started with a clean installation of the 64-bit Bullseye version of the Raspberry Pi OS. I built pyenv following a guide on RealPython, installed Python 3.9.15, and then ended up with a ~/.pyenv folder. I then changed to that Python using python global 3.9.15 and ran pip install anki. At this piont, where should I go to run it? I’m used to finding a file in a /bin folder of some type that I can run with ./anki, but when I went looking I just found an anki folder under the site-packages folder, which seemed to have all the components of Anki but I couldn’t figure out how to open it.

Thanks so much for your help! And sorry if this question is stupid, I swear though that I have been trying everything and the next step here has just been escaping me…

Here are the steps I recommend (similar to being Intro & Downloads - Anki Betas):

sudo apt install python3-pyqt5.{qtwebengine,qtmultimedia}

(install some required packages)

cd ~

(navigate to your home folder: ~ is a shortcut for the path to your home folder)

python3 -m venv --system-site-packages pyenv

(create a python virtual environment called pyenv)

pyenv/bin/pip install --upgrade pip

(upgrade the pip installation tool to the latest version)

pyenv/bin/pip install --upgrade aqt

(install the latest stable version of Anki via aqt)

To run Anki, run ~/pyenv/bin/anki and it should start working!

Note: I am unsure which exact Python guide you’ve followed, but in general running commands which install random packages in a frenzy of frantic desperation is not recommended for security reasons :slight_smile:

IT WORKS! Thank you so much! I don’t actually know what I missed before (might try to recreate it later on a spare SD card to figure it out), but I now have Anki running on the Pi! Since I use Anki in classes, I was having problems with students who use iOS (the Anki installed by sudo apt install anki is 2.1.8), so this now solves a whole host of problems for me.

The one thing I noted is this:

Traceback (most recent call last):
  File "/home/classpi/pyenv/lib/python3.9/site-packages/aqt/", line 13, in <module>
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-2: ordinal not in range(256)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/classpi/pyenv/bin/./anki", line 5, in <module>
    from aqt import run
  File "/home/classpi/pyenv/lib/python3.9/site-packages/aqt/", line 15, in <module>
    raise Exception("Anki requires a UTF-8 locale.") from exc
Exception: Anki requires a UTF-8 locale.

I usually have my character set on ISO-8859-1 (I live in Spain), and have never seen this problem before. Is this specific to when you run Anki from Python?

Oh yeah, I know. I’ve been doing all this from a clean Raspberry Pi installation and flashing the SD card again every time things went particularly wrong. Now that I have it all set, I’ll probably do a final clean install and will put on all the programs I need.

Again, thanks so much for your help! :slight_smile:

No worries!

Hopefully if the character set error no longer happens it won’t be a problem (Have you changed yours to a UTF-8?). If this issue still persists I am afraid I won’t be able to help as I have very limited knowledge on this topic.

Please let me know if you have problems with loading images you’ve added into your cards (assuming you are running Raspberry Pi OS), as I am currently trying to solve a related bug.

Yeah, don’t worry, I changed the character set. Hopefully it’ll get resolved in the future (changing the whole character set for one app is a bit much), but for now it’s okay.

For sure! I saw your post a few days ago. I’ll check it out tomorrow and let you know in the relevant post whether I have the same problem or not.

Anki requires a UTF-8 locale because files in the media folder/shared decks may contain characters outside of 8859-1.

Oh okay, makes sense. Thanks!