I have installed Anki (Version 2.1.54 (b6a7760c) Python 3.9.2 Qt 5.15.2 PyQt 5.15.2) on Linux using the aqt pip library as per https://betas.ankiweb.net/#via-pypipip, and all is functioning except images (though I have not tested audio files).
The images display as the blue image icon, but the images work on non-python Anki instances as well as on the mobile apps.
The images don’t load anywhere in Anki, including the preview, browse, editor, and main Anki card viewer.
The files are fine in the collection.media folder and open without errors, but they do not display in this Anki installation, even when changing the img scr to an absolute path.
When opening Help>About from the main menu, the Anki logo image renders correctly, so I am unsure of the cause of the problem.
Steps to reproduce: install Anki as per the guide linked above, open a card which has an image in it.
I’ve managed to make a few observations using the debug info (I had forgotten to write export and instead just ran QT_DEBUG_PLUGINS=1 in the terminal!).
Firstly, changing the name of the image in the deck browser editor to another name returns a Not found: in the terminal, but this does not happen when the original name is inputted, meaning that Anki can find the file.
Secondly, I used the code from github: ankitects/anki/blob/main/qt/aqt/about.py to find the path of the working image in the About pop-up, and to my amazement it (/_anki/imgs/anki-logo-thin.png) worked!
I then thought perhaps the permissions were set up incorrectly but the files in the collection.media and the site-packages/aqt/data/web/imgs folder had the same permissions. I copied the anki-logo-thin.png file over to the collection.media folder where the images on my cards were, put the name into the editor, but the image did not load, despite not returing a Not found: error.
Perhaps this has something to do with the collection.media.db2 database? I tried reading it but there are a lot of non-ASCII characters with the names of my image files between them. I have rebuilt the database using the menu option in Anki but this doesn’t change anything.
Copying the image I want to include in my card to /anki-venv/lib/python3.9/site-packages/aqt/data/web/imgs/my_image_here.jpg and changing the path of the image in the html to /_anki/imgs/my_image_here.jpg displays the image. However, this is a tacky workaround which would require manual intervention each time an image is put into Anki.
You said you tested Anki in a Python Virtual Environment, was this on Linux? I am running Debian GNU/Linux 11 (bullseye) aarch64.
I tested with a stock Debian 11. The media database is unlikely to be related to the issue, and deleted files being in it is normal. It sounds like it may be an issue with the Qt version distributed with Raspberry Pi OS.