Package Details: anki-sync-server-git r425.ef41934-1

Git Clone URL: (read-only, click to copy)
Package Base: anki-sync-server-git
Description: A sync server for anki using a forked version from (orig:dsnopek)
Upstream URL:
Keywords: anki
Licenses: GPL
Conflicts: anki-sync-server
Provides: anki-sync-server
Submitter: None
Maintainer: s7hoang
Last Packager: s7hoang
Votes: 0
Popularity: 0.000000
First Submitted: 2016-03-13 20:03 (UTC)
Last Updated: 2022-10-12 00:47 (UTC)

Latest Comments

1 2 Next › Last »

berturion commented on 2023-11-26 22:07 (UTC)

Thank you s7hoang for your quick answer. I was not aware of this built-in server implementation. I will try this then.

s7hoang commented on 2023-11-26 17:34 (UTC) (edited on 2023-11-26 19:19 (UTC) by s7hoang)

Yeah, it's been awhile since I updated this.

There's actually not much point in using this because the actual anki team has made their own self-hosted server:

I tried it out and it works just fine with the android app. No need for nginx either; looks like the android app may have relaxed the requirement for HTTPS. So, you can just use HTTP. That means no need for certs either.

When I have time I'll either remove this package entirely or make it work in the same way as it does now (runs as a separate user with a startup script).

berturion commented on 2023-11-26 16:57 (UTC)

Hi, I am sorry, I am not an expert in python things. I just tried to install this package because I use the Anki Android app and wanted to synchronize my cards and ran into several issues I am sure someone know already.

During my first attempt, I encounterd this message:

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
    python-xyz', where xyz is the package you are trying to

    If you wish to install a non-Arch-packaged Python package,
    create a virtual environment using 'python -m venv path/to/venv'.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.

    If you wish to install a non-Arch packaged Python application,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. Make sure you have python-pipx
    installed via pacman.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

So I created the file /opt/anki-sync-server/.config/pip/pip.conf and put this:

break-system-packages = true

I re-installed the package and I had another issue :

Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]

      Cargo, the Rust package manager, is not installed or is not on PATH.
      This package requires Rust and Cargo to compile extensions. Install it through
      the system's package manager or via

      Checking for Rust toolchain....
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

So I installed the package rust to my system. After my 3rd attempt to install anki server, I obtained these errors :

Successfully built orjson psutil stringcase
Installing collected packages: stringcase, send2trash, zipp, urllib3, soupsieve, PySocks, psutil, protobuf, orjson, markdown, idna, distro, decorator, charset-normalizer, certifi, requests, importlib-metadata, beautifulsoup4, anki
  WARNING: The script send2trash is installed in '/opt/anki-sync-server/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script markdown_py is installed in '/opt/anki-sync-server/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script distro is installed in '/opt/anki-sync-server/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script normalizer is installed in '/opt/anki-sync-server/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
google-api-core 2.11.0 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 4.21.2 which is incompatible.
googleapis-common-protos 1.61.0 requires protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0.dev0,>=3.19.5, but you have protobuf 4.21.2 which is incompatible.
Successfully installed PySocks-1.7.1 anki-2.1.49 beautifulsoup4-4.11.1 certifi-2022.6.15 charset-normalizer-2.1.0 decorator-4.4.2 distro-1.7.0 idna-3.3 importlib-metadata-4.12.0 markdown-3.3.7 orjson-3.7.5 protobuf-4.21.2 psutil-5.9.1 requests-2.28.1 send2trash-1.8.0 soupsieve-2.3.2.post1 stringcase-1.2.0 urllib3-1.26.9 zipp-3.8.0

The package seems to be installed though, but when I run it, it fails with:

[anki-sync-server@sheldon ~]$ python -m ankisyncd
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/anki-sync-server/ankisyncd/", line 8, in <module>
    import ankisyncd.sync_app
  File "/opt/anki-sync-server/ankisyncd/", line 33, in <module>
    from anki.collection import Collection
  File "/opt/anki-sync-server/.local/lib/python3.11/site-packages/anki/", line 10, in <module>
    from anki import (
  File "/opt/anki-sync-server/.local/lib/python3.11/site-packages/anki/", line 14, in <module>
    from anki import generic_pb2 as anki_dot_generic__pb2
  File "/opt/anki-sync-server/.local/lib/python3.11/site-packages/anki/", line 28, in <module>
    _EMPTY = _descriptor.Descriptor(
  File "/opt/anki-sync-server/.local/lib/python3.11/site-packages/google/protobuf/", line 296, in __new__
TypeError: Descriptors cannot be created directly.
If this call came from a file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information:

I am stuck at his point.

mattski commented on 2022-10-11 06:43 (UTC)

FYI - the INSTALL file is failing the integrity check. I have worked around manually but it would be good if the package was updated.

s7hoang commented on 2022-07-11 16:09 (UTC) (edited on 2022-07-12 17:37 (UTC) by s7hoang)

It looks like the repository has changed some stuff around. So my instructions are probably out of date.

It looks like "" doesn't exist in the default branch anymore. It does however still exist in the "main" branch though.

I tried this only up to getting the server to work (but so far so good) on a fresh copy of manjaro. The steps to getting it to work are:

1. In PKGBUILD change:




2. manually install the python packages using:
  cd /opt/anki-sync-server
  sudo -u anki-sync-server pip install -r requirements.txt --user

Before you do that though, the version on "protobuf" is too new and throws errors (4.21.2). The one on my machine is "3.19.3" that gets the server to work.

3. copy "" to the root:
 cd /opt/anki-sync-server/ankisyncd_ctl
 sudo -u anki-sync-server cp ..
 cd ..
 sudo -u anki-sync-server ./ adduser <whoever>

It should generate some files:

  • auth.db
  • collections (directory)
  • session.db (I believe this comes once you can successfully sign in)
4. it should work from there
 cd /opt/anki-sync-server
 sudo -u anki-sync-server python -m ankisyncd

I'll update the package over the weekend.

You can check the output of the servers by running them in the foreground:

sudo systemctl stop nginx anki-sync-server

then in two terminals:

cd /opt/anki-sync-server
sudo -u anki-sync-server python -m ankisyncd


sudo nginx

make sure daemon off; is set in nginx.conf.

If they're working right, you should actually be able to visit them from a regular browser on ports 27701 (nginx) and 27702 (ankisyncd). For example while on the same network, my test setup is on From my windows computer I visit (and 27702) and I get

<html><head></head><body>Anki Sync Server</body></html>

You'll see corresponding log stuff on the foregrounded processes server side. Also, you actually don't need nginx for http so you can try disabling that for troubleshooting; for mobile use you need https though.

I'll try again, but the only problem I found from rejigging my setup to use the test setup was that I needed to change the anki client's plugin from https to http, and the ip address.

cable commented on 2022-06-29 00:35 (UTC)

I appreciate the work, but I can't get this to work at all. The manual says that running "sudo -u anki-sync-server ./ adduser <username>" inside "/opt/anki-sync-server" should create a username and allow to set a password, but "" isn't in that directory. After copying it from the "_cli" directory to the main directory, running it still doesn't work because the python libraries need to be found. After making the python path accessible, and creating a username and password, and copying the file to the appropriate location, anki still complains of an incorrect username/password pair. Don't know how to get this working.

Any advice would be appreciated.

s7hoang commented on 2022-02-05 01:35 (UTC)

added, thanks!

clarfonthey commented on 2022-01-30 23:15 (UTC) (edited on 2022-02-03 04:32 (UTC) by clarfonthey)

Even though the files are included in the git repo, you should still include them in the source array since tools like mkchrootpkg will only copy over the listed sources and not every file.

At least for me, I need to patch those in for it to work.

Here's the full patch I made in case anyone wants it / the maintainer wants to incorporate it:

diff --git a/PKGBUILD b/PKGBUILD
index 2ede655..a0101e6 100644
@@ -13,35 +13,52 @@ depends=('python' 'python-pip' 'nginx')
 makedepends=('git' 'portaudio')
+        ''
+        ''
+        ''
+        'anki-sync-server.groff'
+        'anki-sync-server.install'
+        'anki-sync-server.service'
+        'nginx_append_config.awk'
+        'nginx_http'
+        'nginx_https')
+            '5f6c65418841bd638065b7c874a267898f8abb1c5c56dfd47c5908a4f9a83465'
+            'df3efb08711b0ef9be3a2e264cd54bd8d50d77576f538f499dcbfce1c4b4d9df'
+            'cc2ec96b2ec18d8b161f0c8233c1ddff58cddb59bfd05e1c5910eb7ef0ce9c93'
+            '48ed322539cff276909d8eb6d81c17c776e1f2ec6353ce6aef1b8a559271b0ad'
+            '09704f72e1d8a804d0a2de6443adbbec98431564538c95c28fed713ce219ecfb'
+            'eb6b4f2682290e341a377bee12246c076816789d8f716fdd26c7367a47408e91'
+            'e8b0bc5a03fd39423c64fc804199b258d53f2ad5327954d74d3a3be0dfe7924a'
+            '9a48034fabdf487502663149d7cfd4a59bdf0e116e681c790e0c39b23267d7cb'
+            '7638620d532a55e3423cee9ee7905941ef81fae1b024bf7960bee1b9dcd65efe')
 backup=(etc/nginx/sites-available/{anki-sync-server-http,anki-sync-server-https} usr/lib/systemd/system/anki-sync-server.service)

-_repo_dir_="$(basename ${source} | cut -f 1 -d '.')"

 pkgver() {
-  cd "${_repo_dir_}"
+  cd "${srcdir}/anki-sync-server"
   printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"

 prepare() {
   # move plugins and systemd file to src package
-  local _plugins_="${_anki_dir_}/plugins/"
+  local _anki_dir_="${srcdir}/anki-sync-server/src"
+  local _plugins_="${_anki_dir_}/plugins"
   mkdir -p "${_plugins_}"
   mkdir -p "${_plugins_}/anki2.0/"
   mkdir -p "${_plugins_}/anki2.1/anki-sync-server"
   mkdir -p "${_plugins_}/anki2.1.28/anki-sync-server"
   mkdir -p "${_plugins_}/nginx/"
   mkdir -p "${_plugins_}/systemd/"
-  cp "../" "${_plugins_}/anki2.0/"
-  cp "../" "${_plugins_}/anki2.1/anki-sync-server/"
-  cp "../" "${_plugins_}/anki2.1.28//anki-sync-server/"
-  cp "../anki-sync-server.service" "${_plugins_}/systemd/"
-  cp "../nginx_http" "${_plugins_}/nginx/anki-sync-server-http"
-  cp "../nginx_https" "${_plugins_}/nginx/anki-sync-server-https"
-  cp "../nginx_append_config.awk" "${_plugins_}/nginx/append.awk"
+  cp "${srcdir}/" "${_plugins_}/anki2.0/"
+  cp "${srcdir}/" "${_plugins_}/anki2.1/anki-sync-server/"
+  cp "${srcdir}/" "${_plugins_}/anki2.1.28//anki-sync-server/"
+  cp "${srcdir}/anki-sync-server.service" "${_plugins_}/systemd/"
+  cp "${srcdir}/nginx_http" "${_plugins_}/nginx/anki-sync-server-http"
+  cp "${srcdir}/nginx_https" "${_plugins_}/nginx/anki-sync-server-https"
+  cp "${srcdir}/nginx_append_config.awk" "${_plugins_}/nginx/append.awk"

   # set plugins to use current ip address as plugins' target address
   cd "${_anki_dir_}"
@@ -68,22 +85,24 @@ prepare() {

 package() {
+  local _anki_dir_="${srcdir}/anki-sync-server/src"
   # anki-sync-server package
   mkdir -p "${pkgdir}${_install_dir_}"
-  cp -R "${srcdir}/${_anki_dir_}/." "${pkgdir}${_install_dir_}"
+  cp -R "${_anki_dir_}/." "${pkgdir}${_install_dir_}"

   # manpage
   mkdir -p "${pkgdir}/usr/share/man/man1"
-  cp "${srcdir}/${_anki_dir_}/plugins/man/man1/anki-sync-server.1.gz" \
+  cp "${_anki_dir_}/plugins/man/man1/anki-sync-server.1.gz" \

   # nginx
   mkdir -p "${pkgdir}/etc/nginx/sites-available"
   mkdir -p "${pkgdir}/etc/nginx/sites-enabled"
-  cp "${srcdir}/${_anki_dir_}/plugins/nginx/anki-sync-server-http" "${pkgdir}/etc/nginx/sites-available"
-  cp "${srcdir}/${_anki_dir_}/plugins/nginx/anki-sync-server-https" "${pkgdir}/etc/nginx/sites-available"
+  cp "${_anki_dir_}/plugins/nginx/anki-sync-server-http" "${pkgdir}/etc/nginx/sites-available"
+  cp "${_anki_dir_}/plugins/nginx/anki-sync-server-https" "${pkgdir}/etc/nginx/sites-available"

   # systemd service
   mkdir -p "${pkgdir}/usr/lib/systemd/system/"
-  cp "${srcdir}/${_anki_dir_}/plugins/systemd/anki-sync-server.service" "${pkgdir}/usr/lib/systemd/system/"
+  cp "${_anki_dir_}/plugins/systemd/anki-sync-server.service" "${pkgdir}/usr/lib/systemd/system/"

s7hoang commented on 2022-01-23 07:32 (UTC) (edited on 2022-01-23 07:32 (UTC) by s7hoang)

rats! I was just finishing up work on it and hoping no one would've noticed :P

yeah during testing at that time I was using 27701-27703 for testing the http, https and anki servers and forgot to update those files.

but, I made some changes to this package and it now has:

  • 2 server files (http & https) : https is needed for AnkiDroid in particular

  • a manpage with instructions for setting up the https server

  • the ports are now properly set to 27701 for the client plugins :P

give it a spin!

goffi commented on 2022-01-19 19:59 (UTC)


I could not do any sync from Anki desktop (anki-bin package) to Anki Sync Server installed with this package, while download was working fine. The issue is the same as and I found that the file of the plugin was incorrectly using 27702 (Anki Sync Server port directly) instead of 27701 (NGINX proxy), see my comment at After changing the port for 27701, it's working fine.

Thanks for maintaining this package, once this little issue fixed, it's working well.