# I'm trying to package Anki snap version

**URL:** <https://forums.ankiweb.net/t/im-trying-to-package-anki-snap-version/52322>\
**Category:** Help\
**Created:** [November 24, 2024, 11:48am UTC](https://forums.ankiweb.net/t/im-trying-to-package-anki-snap-version/52322 "2024-11-24T11:48:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![aoyama](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@aoyama](https://forums.ankiweb.net/u/aoyama)\
**Post date:** [November 24, 2024, 11:48am UTC](https://forums.ankiweb.net/t/im-trying-to-package-anki-snap-version/52322/1 "2024-11-24T11:48:32Z")

</div>

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

However, all functions work except mpv intergration …

I got those error msgs:

```bash
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.

```bash
❯ 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

---

<div class="post-metadata">

**Author:** ![aoyama](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@aoyama](https://forums.ankiweb.net/u/aoyama)\
**Post date:** [November 26, 2024, 11:32am UTC](https://forums.ankiweb.net/t/im-trying-to-package-anki-snap-version/52322/2 "2024-11-26T11:32:58Z")

</div>

Finally, the cause of the problem was found from the sound.py \_\_packageCmd() function.

```python
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"]

```

---

<div class="post-metadata">

**Author:** ![aoyama](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@aoyama](https://forums.ankiweb.net/u/aoyama)\
**Post date:** [November 26, 2024, 12:48pm UTC](https://forums.ankiweb.net/t/im-trying-to-package-anki-snap-version/52322/3 "2024-11-26T12:48:16Z")

</div>

@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](https://github.com/boukendesho/)

Looking forward to your reply.

Thanks.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [November 29, 2024, 12:55pm UTC](https://forums.ankiweb.net/t/im-trying-to-package-anki-snap-version/52322/4 "2024-11-29T12:55:42Z")

</div>

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](https://snapcraft.io/anki-woodrow)

---

<div class="post-metadata">

**Author:** ![aoyama](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@aoyama](https://forums.ankiweb.net/u/aoyama)\
**Post date:** [November 29, 2024, 1:46pm UTC](https://forums.ankiweb.net/t/im-trying-to-package-anki-snap-version/52322/5 "2024-11-29T13:46:07Z")

</div>

I got it. Thanks for the explanation.

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

---

<div class="post-metadata">

**Author:** ![aoyama](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@aoyama](https://forums.ankiweb.net/u/aoyama)\
**Post date:** [November 30, 2024, 1:06am UTC](https://forums.ankiweb.net/t/im-trying-to-package-anki-snap-version/52322/6 "2024-11-30T01:06:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [December 6, 2024, 8:16am UTC](https://forums.ankiweb.net/t/im-trying-to-package-anki-snap-version/52322/7 "2024-12-06T08:16:04Z")

</div>

Sorry for the delay. What change are you proposing exactly? If it doesn’t cause any problems for the existing packages (i.e. you can’t just remove lines of code that the offical builds depend on), then I would be happy to consider it.

---

<div class="post-metadata">

**Author:** ![aoyama](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@aoyama](https://forums.ankiweb.net/u/aoyama)\
**Post date:** [December 6, 2024, 8:29am UTC](https://forums.ankiweb.net/t/im-trying-to-package-anki-snap-version/52322/8 "2024-12-06T08:29:06Z")

</div>

> <https://github.com/boukendesho/anki-snap/blob/master/keep_ldpath.patch>

The main intention of this patch is to keep LD\_LIBRARY\_PATH in the snap environment.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [December 6, 2024, 8:30am UTC](https://forums.ankiweb.net/t/im-trying-to-package-anki-snap-version/52322/9 "2024-12-06T08:30:43Z")

</div>

That would be fine 👍

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [January 5, 2025, 8:31am UTC](https://forums.ankiweb.net/t/im-trying-to-package-anki-snap-version/52322/10 "2025-01-05T08:31:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
