I'm trying to package Anki snap version

And I did it. The snap version works really well.

However, all functions work except mpv intergration …

I got those error msgs:

todo: windows paths in import screen
Starting main loop...
mpv: error while loading shared libraries: libass.so.9: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/snap/anki-desktop/x8/lib/python3.12/site-packages/aqt/sound.py", line 854, in setup_audio
    mpvManager = MpvManager(base_folder, media_folder)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/snap/anki-desktop/x8/lib/python3.12/site-packages/aqt/sound.py", line 408, in __init__
    super().__init__(window_id=None, debug=False)
  File "/snap/anki-desktop/x8/lib/python3.12/site-packages/aqt/mpv.py", line 442, in __init__
    super().__init__(*args, **kwargs)
  File "/snap/anki-desktop/x8/lib/python3.12/site-packages/aqt/mpv.py", line 104, in __init__
    self._start_socket()
  File "/snap/anki-desktop/x8/lib/python3.12/site-packages/aqt/mpv.py", line 194, in _start_socket
    raise MPVProcessError("unable to start process")
aqt.mpv.MPVProcessError: unable to start process

mpv too old or failed to open, reverting to mplayer

What confuses me is that libass.so.9 is already included in the snap.
And running mpv directly through the snap debug shell is also ok.

❯ snap run --shell anki-desktop
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

myuser@mypc:/snap/anki-desktop/x8$ mpv --version
mpv v0.38.0-dirty Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on Aug 21 2024 19:24:58
libplacebo version: v6.338.2
FFmpeg version: 7.0.2
FFmpeg library versions:
   libavutil       59.8.100
   libavcodec      61.3.100
   libavformat     61.1.100
   libswscale      8.1.100
   libavfilter     10.1.100
   libswresample   5.1.100


Then I looked at the source code, anki runs mpv through python’s subprocess Popen.

But why it not works? I have no idea at the moment.

Any suggestions? please help me

1 Like

Finally, the cause of the problem was found from the sound.py __packageCmd() function.

def _packagedCmd(cmd: list[str]) -> tuple[Any, dict[str, str]]:
    cmd = cmd[:]
    env = os.environ.copy()
    if "LD_LIBRARY_PATH" in env:
        del env["LD_LIBRARY_PATH"]
1 Like

@dae Sorry for direct mention.

After the mpv issue been solved, I move on to test anki snap version, and it works well.

I would like to know the official view on snap support. If there is no official plan to support it, I am willing to maintain a community supported version.

But currently the name ‘anki’ in the snap store is reserved, and I need official approval to take over the name. Are you willing to support me?

I have some exp on snap packaging, here is my gh boukendesho (hideo aoyama) · GitHub

Looking forward to your reply.

Thanks.

I think adding a suffix like anki-aoyama would make it clearer to users that it’s a community-provided build. That’s what the last person did. Had they been using ‘anki’ as the name, new users installing Anki would find themselves with an out of date version, after the maintainer gave up after a year: Install Anki - unofficial on Linux | Snap Store

I got it. Thanks for the explanation.

2024年11月29日(金) 22:05 Damien Elmes via Anki Forums <notifications@anki2.discoursemail.com>:

Although it is a pity that cannot get the name for snap, does it welcome to open a snap-related PR to the code repository?

Just like the above, LD_LIBRARY_PATH related.