New online installer/launcher

Hi all,

The tool we use to build Anki’s official packages is unfortunately no longer being developed, meaning we need to migrate to something else. Rather than opting for something similar to what we’re currently using, I’ve been looking into a somewhat different approach, and it’s now ready for initial testing & feedback.

Previously, releases were made by packaging up all of our Python libraries into a compressed archive, and distributing that. That meant every small update required users to download all of Anki’s dependencies, including the hundreds-of-megabytes Qt. This new approach is closer to Chrome’s installer: it is a small launcher that downloads Anki’s dependencies when launched.

There are some tradeoffs with this approach. The initial run is slower, especially on macOS, as the dependencies need to be downloaded and verified. It also provides no out-of-the-box ‘offline install’ - internet access is required on first run (but after first run, the resulting program files can be copied to other machines if desired).

There are a number of big advantages though:

  • It makes it really simple to implement auto-update functionality.
  • It makes it much easier for users to make tweaks to their environment (prefer an older Qt? You can easily switch it out with a quick edit to a file)
  • It’s much closer to the way devs run Anki during development, reducing the number “works for me” cases

On first run, you should see Anki’s dependencies being downloaded. On Linux, you’ll need to launch Anki from a terminal to see the progress. Subsequent launches require no network access, so you should find Anki launches like normal.

Anki’s dependencies are placed in the following locations:

  • Windows: %LOCALAPPDATA%\AnkiProgramFiles
  • Mac: ~/Library/Application Support/AnkiProgramFiles
  • Linux: ~/.local/share/AnkiProgramFiles

You can recreate the first install case by removing that folder (but downloads are cached separately, so things will be faster the second time round).

I’d appreciate it if you could give it a try, and let us know if you run into any problems. Feedback on the approach in general is welcome too.

Download links:

The Mac and Linux builds should work on both x86 and ARM machines.

I’ll follow-up with some more technical info for the curious.

17 Likes

I understand that this currently is a beta. But in the future, there should be an indication on app launch.

I have to say I quite dislike that. Can we provide the dependencies too as seperate packages? Anki then could check if it’s available and only download when neccessary.


There is an issue. On debian linux, after running sudo ./install, I get the following output:

'anki' -> '/usr/local/share/anki/anki'
'anki.1' -> '/usr/local/share/anki/anki.1'
'anki.desktop' -> '/usr/local/share/anki/anki.desktop'
'anki.png' -> '/usr/local/share/anki/anki.png'
'anki.xml' -> '/usr/local/share/anki/anki.xml'
'anki.xpm' -> '/usr/local/share/anki/anki.xpm'
'install.sh' -> '/usr/local/share/anki/install.sh'
'launcher.amd64' -> '/usr/local/share/anki/launcher.amd64'
'launcher.arm64' -> '/usr/local/share/anki/launcher.arm64'
'pyproject.toml' -> '/usr/local/share/anki/pyproject.toml'
'README.md' -> '/usr/local/share/anki/README.md'
'uninstall.sh' -> '/usr/local/share/anki/uninstall.sh'
'uv.amd64' -> '/usr/local/share/anki/uv.amd64'
'uv.arm64' -> '/usr/local/share/anki/uv.arm64'
'.python-version' -> '/usr/local/share/anki/.python-version'
Install complete. Type 'anki' to run.

If I now type anki, I get

Error: Launcher not found: /usr/local/bin/launcher.amd64

The reason is the paths don’t match.

Edit: The fix is quite easy, though. In the anki file, just change the variable SCRIPT_DIR like so:

SCRIPT_DIR="/usr/local/share/anki"

After that, everythink works fine and anki opens.

Edit 2: With this build finally Webview cursor not changing type (or changing unreliably) since Qt 6.4.0 update · Issue #2168 · ankitects/anki · GitHub is fixed, which I really love.
Edit 3: With this beta, hiding the cursor works as well (see Why can't I hide the cursor with js or css and how to solve it (Anki for Desktop)?) :tada:

5 Likes

Technical info

We accomplish this with a small Rust launcher, whose job it is to look for changes to bootstrap the project dir, and invoke uv (which we bundle) to build the venv.

To ensure all users get the same library versions for a given release, a new PyPI package called anki-release has been published. It’s currently a temporary version number, but the intention moving forward is users will be able to simply list ‘anki-release==25.06’ or similar to pick a particular version and all the dependencies we’ve frozen for that version.

During testing, the anki and aqt modules have been uploaded to testpypi with low version numbers, as a few tweaks were required for the new packaging process. This makes the shipped pyproject.toml file a bit more complicated than it should ultimately be.

On Windows, we invoke uv as a console app so that install progress can be seen. On macOS, we relaunch ourselves in a terminal so the user can see progress. On Linux, we currently don’t do anything like that, since there’s no universal terminal app. It could be improved in the future to try some common terminals like xterm.

2 Likes

It’s technically possible, but I don’t think most users would opt for that, and it would be hard to justify the hundreds of megabytes of wheels I’d have to distribute for each of our 5 platform/arch targets.

Thanks, I’ll fix that in the next build. Recommend just skipping the install and using ./anki for now.

I see. Can we manually download these files (like with a download link) from where anki gets them on first launch? If yes, then we could just provide the download links for users that want a fully offline launch.

1 Like

Importing not working

Another thing: I don’t know if this is related to this beta, but I tried to import a .colpkg and it never proceeds after the loading screen:

After killing anki and opening it again, the import seemingly did finish though.

Auto theme support not working

If I turn on dark mode via gnome, anki doesn’t change the theme to “dark” anymore (but it does work when manually set to dark in the preferences).

(yes, it is set to “Follow System”)

Edit: The theme seems to change correctly after waiting for several minutes (more than 5 minutes in my case).

This launcher is basically a user-friendly wrapper over uv. If you need more flexibility, you can invoke uv yourself to export the dependency list and vendor it with your chosen tool.

Can you reproduce it?

The code that handles this hasn’t changed in a long time:

    if is_lin:
        # On Linux, the check requires invoking an external binary,
        # and can potentially produce verbose logs on systems where
        # the preferred theme cannot be determined,
        # which we don't want to be doing frequently
        interval_secs = 300

I noticed four issues, the first one being most important:

  • After closing Anki, if I try to launch it again, Anki doesn’t start at all. I have to kill Python in the Task Manager in order to be able to launch Anki again.
  • This update has increased the installed size of Anki by about 155 MB. Previously, %LOCALAPPDATA%\Programs\Anki had a size of 507 MB. Now, this folder has a size of 51 MB and %LOCALAPPDATA%\AnkiProgramFiles has a size of 611 MB. So, the total installed size of Anki is now 662 MB opposed to 507 MB earlier. In addition, %LOCALAPPDATA%\uv has a size of 613 MB. I seriously hope that this cache is automatically deleted after installation.
  • The installation progress displayed in Terminal seems scary for an average user.
  • Anki appears as Python, rather than anki.exe, in the Task Manager.
2 Likes

I tried the new flow. Works well for me, but I’d prefer that after the launcher’s installer is completed, we immediately open the actual launcher to download the actual Anki dependencies, so the user installation flow is more or less sustained continuously

I agreed that this is pretty scary thing to see, especially that it is downloading some files from the internet. Average user might think it’s a virus or something…

4 Likes

Yes. In fact, the same happens when I try to export.

Steps to reproduce

  1. Open new profile.
  2. Add random basic card.
  3. Try to export.
  4. The action never seems to complete.

Same with import.

It works fine in current main, but not in this beta release.

Just giving my experience in case it helps with debugging.

It works fine for me on linux.

I appears as anki for me, which is expected (also on linux).

If we already have the latest 25.06b1, then what version of Anki does the new installer install?

Will the installer simply verify that everything is up to date, and modify nothing?

This new beta is used to test a new way of releasing anki. It reports the following for me in Help > About:

Version ⁨25.06 (6a318d17)⁩
Python 3.13.2 Qt 6.8.1 PyQt 6.8.0

For me, on Windows, after using anki-install.exe, Help/About in Anki is reporting a different hex code from yours and a different Python version.

Version ⁨25.06 (5a4fa50a)⁩
Python 3.9.23 Qt 6.8.1 PyQt 6.8.0

Meanwhile the releases page has yet another hex code, namely b32a972

1 Like

Version 5a4fa50a doesn’t automatically restore all windows when reopened.

It only opens the Decks window, although I also had the Add and Browse windows open when Anki was shut down.

However, if I click on Add or Browse in the menu, it opens those windows with the same positions and dimensions as they had when Anki was shut down.

It’s no big deal or inconvenience, I just wonder if this is an intentional change.


Also, if the text size was reduced by using Ctrl + mouse scroll wheel in any of the windows, it does not remember the new reduced text size when restarting Anki. The text size reverts to the large-ish default.

I’m not sure if the old version also worked this way.

  • Anki appears as Python, rather than anki.exe, in the Task Manager.

If I type “anki” into the search field of the Windows Task Manager, it shows anki.exe as the process running.

But if I type “mpv.exe” into that search field, it shows Python as the process running.

Oh well, I don’t understand this then. Weird black magic…

Did this ever happen? Even going back to ⁨24.11 (87ccd24e)⁩ it doesn’t do that for me.

I’m pretty sure that’s normal (i.e. wasn’t introduced by this beta).

Hello, just a couple questions: from 25.06+ will offline installers be offered at all? Will running anki from a flash drive be affected by this? I am a windows user and the installers I’ve used so far worked perfectly well for installing to and running from flash drives.

6 Likes

My two cents

  1. Showing a terminal will be scary to many people, or at least, it will look like an unpolished experience. I know people that thought they installed a virus when some app suddenly shows a terminal
  2. The installation having two steps is unexpected. When I saw the Anki shortcut in my desktop after running the installer, I thought that everything was done. I didn’t expect that another installation step was necessary.
9 Likes

This is wonderful.

2 Likes