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.