Anki doesn't start under Wayland (Linux)

When installing latest Anki from the website tar dist, it does not run my PC. I’m using SwayWM with QT_QPA_PLATFORM=wayland . I’m guessing some Wayland client libs are missing from the bundled Qt distribution.


Qt warning: QSocketNotifier: Can only be used with threads started with QThread 
Qt warning: Failed to load client buffer integration: "wayland-egl" 
Qt warning: Available client buffer integrations: () 
Qt warning: No shell integration named "xdg-shell" found 
Qt warning: No shell integration named "xdg-shell-v6" found 
Qt warning: No shell integration named "wl-shell" found 
Qt warning: No shell integration named "ivi-shell" found 
Qt warning: Loading shell integration failed. 
Qt warning: Attempted to load the following shells ("xdg-shell", "xdg-shell-v6", "wl-shell", "ivi-shell") 
Qt warning: Wayland does not support QWindow::requestActivate() 

Output (with QT_DEBUG_PLUGINS=1): Tar Dist Anki Output -

There are two workarounds:

  • install anki from pip (sudo pip install anki aqt)
    this works fine as it uses my system Qt libs (in fact I’d go so far as to recommend this to other Linux users as it also picks up my desktop themes, settings etc)
  • run anki with QT_QPA_PLATFORM=xcb

For reference, here is output from pip-installed anki, which works:
Output from pip-installed anki with QT_DEBUG_PLUGINS=1: pip anki output -

N.B. I tried to include the above pastes in this with <details><summary> etc, but it went over the post size limit :frowning:

Thanks for all the dev work on Anki!

1 Like

Is there anyone else successfully using the packaged builds with Wayland? If it’s universally broken then perhaps it would make sense to force the platform to xcb on startup.

I’m running Anki on Wayland. So far I haven’t noticed any issues :eyes:

I’ve been running from source for some time now. I’ll test the 2.1.44 packaged build…

Thanks for looking into this - for anyone else testing, could you check as well if your Anki is using xwayland or native Wayland? Some distros will set xwayland as default for Qt via env vars.

It would be good if the package build could support native Wayland so you get e.g. proper scaling when you drag the window from a high dpi laptop screen to a normal dpi desktop monitor… But showing the window at all will still be an improvement :slight_smile:

1 Like

You’re right, with

export QT_QPA_PLATFORM=wayland

the packaged build of Anki 2.1.44 won’t start. I get the same error as you.

It does work when running from source though. Anki starts and I get crisp high-dpi scaling.

I have to correct myself here. I was using xwayland before.

I’ve pushed a change that should force xcb if wayland is set when running the packaged build - please let me know if that at least allows startup when the next alpha is available. Native support would of course be preferable, but that’ll need to wait for now.

I just tested the 2.1.46 tar distribution on Fedora 34 KDE with Wayland and I’m also getting OP’s error.

What is QT_QPA_PLATFORM set to? The workaround only changes it if it’s set to ‘wayland’

You’re right, sorry–it works with that setting, I just had a typo.

Hello, forumers:

I too am trying to get anki to run on arch with wayland. I’ll list my output when I run it, and attempt to summarize the points made in the thread so far, and what I can make of their relevance to my situation. Please let me know if you have any advice, questions, or if you notice I’m misinterpreting any of the preceding.

My output:

Running with temporary Qt5 compatibility shims.
Run with DISABLE_QT5_COMPAT=1 to confirm compatibility with Qt6.
Preparing to run...
  File "/usr/bin/anki", line 20, in <module>
  File "/usr/lib/python3.10/site-packages/aqt/", line 458, in run
  File "/usr/lib/python3.10/site-packages/aqt/", line 515, in _run
    pmLoadResult = pm.setupMeta()
  File "/usr/lib/python3.10/site-packages/aqt/", line 126, in setupMeta
    res = self._loadMeta()
  File "/usr/lib/python3.10/site-packages/aqt/", line 411, in _loadMeta
resetting corrupt _global
Qt warning: Could not find the Qt platform plugin "wayland" in "" 
Qt warning: could not connect to display  
Qt info: Could not load the Qt platform plugin "xcb" in "" even though it was found. 
Qt fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vkkhrdisplay, vnc, xcb.
Aborted (core dumped)

Summarizing the thread so far:

OP suspected Wayland client libraries are missing from the bundled Qt distribution.

  • out of curiosity, do we still think this is true?

OP notes that the whole issue can be avoided in one of two ways:

  1. by installing anki from pip
    • I might try removing the pacman install and trying again from pip, but the pacman install took at least a half-hour, so I’m hesitant to try.
  2. by running with QT_QPA_PLATFORM=xcb.
    • this resulted in identical output as above, which is curious because even without that variable set, there’s still this line Qt info: Could not load the Qt platform plugin "xcb" in "" even though it was found.

kleinerpirat wrote that he’s running from source and it’s working without issue on xwayland.

  • does this mean that QT_QPA_PLATFORM should be set to xwayland?
    • this doesn’t work when I try it, fwiw.
  • “running from source”, if I understand correctly, means cloning from git and compiling everything? I can add that to my list of things to try.

runiq tested the 2.1.46, and it worked when QT_QPA_PLATFORM=wayland

  • we’re up to 2.1.54, and QT6 sports better wayland support, so I’d like to try that, but I’ll have to figure out how to get it to run in pacman. I’ll get to work on that, unless I’m advised otherwise.

My two leads, then, are to install from source or to make a package from the tarball using Arch Build System.

Thanks for your work so far, and your attention.

Did you try the official build? Linux Distro Packages - Anki Manual

If that has issues too, you can try QT_DEBUG_PLUGINS=1 to get info about why the platform plugin is failing - it may be due to a missing library.

Note that your installation took half an hour probably because you installed the AUR package that already builds from source (that is, it will automatically download the sources on your computer, compile them and put the result at the right place). You can try installing anki-official-binary-bundle or anki-bin (still through the package manager).