Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
Re: anki-2.1.16p7 package issues
To:
wizardo <wizardo3@proton.me>
Cc:
"ports@openbsd.org" <ports@openbsd.org>
Date:
Wed, 20 Nov 2024 12:54:36 +0000

Download raw body.

Thread
On 2024/10/10 14:42, wizardo wrote:
> Is anyone able to run the anki package?  As far as i read
> on the port's makefile the current package version is before upstream
> anki required rust and other stuff to build,

exactly

>                                              but there are some
> issues with the newer versions of python (3.11 is current, while
> anki targets 3.9) My current issues are the program throwing errors
> when i try to import a .apkg file:
> 
> Import failed.  Traceback (most recent call last):
>   File "/usr/local/lib/python3.11/site-packages/aqt/importing.py",
>   line 339, in importFile
>     importer.run()
>   File "/usr/local/lib/python3.11/site-packages/anki/importing/apkg.py",
>   line 32, in run
>     for k, v in list(json.loads(z.read("media").decode("utf8")).items()):
>                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position
> 1: invalid start byte

that seems like it's likely to be specific to the .apkg you're trying to
use; I've just tried a few including with (valid) utf-8 and they seem
ok.

> And when i try to set preferences:
> 
> Error An error occurred.  Please use Tools > Check Database to see
> if that fixes the problem.  If problems persist, please report the
> problem on our support site.  Please copy and paste the information
> below into your report.  Anki 2.1.16 (4bc33e2f) Python 3.11.10 Qt
> 5.15.13 PyQt 5.15.10 Platform: Linux Flags: frz=False ao=False sv=2

I've just committed a fix for that to -current ports.

> As a side note: I also tried to build anki by myself and i even
> tried to get the wheel from a pyenv but nothing works.  I guess the
> python version is the issue. 

No idea about the wheels. Following instructions and using
system-site-packages for py-qt6 deps I can get it so it looks like
it's installed, but there's no bin/anki to run.

Their script to build from source can be partially got to run with
some "sed s,/bin/bash,/bin/sh," on the run/ninja scripts, a few hacks,
and replacing linux binaries that it fetches (node, protoc, python) with
ones from packages (the build needs to be on a filesystem mounted with
"wxallowed"), but it eventually fails in a not-easy-to-hack-around way
with a node.js error trying to install dprint, and python error trying
to install pyqt6 (even if you've already installed py3-qt6 and
py3-qt6webengine from packages and modified the venv to set
include-system-site-packages to true).

I think it's going to be tricky to get it to build on OpenBSD at all,
and very difficult to turn into a port, so patching up the old version
in ports (and removing the port if that stops yielding a usable version)
is probably the way to go for now.