Community Packages

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#58734 - [anki] Fails to start after today's qt update.

Attached to Project: Community Packages
Opened by michael Lojkovic (zerophase) - Friday, 25 May 2018, 23:23 GMT
Last edited by Johannes Löthberg (demize) - Tuesday, 01 January 2019, 17:30 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Felix Yan (felixonmars)
Johannes Löthberg (demize)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 39
Private No



Anki fails at getting a webview during startup.

Additional info:

Error during startup:
Traceback (most recent call last):
File "/usr/share/anki/aqt/", line 50, in __init__
File "/usr/share/anki/aqt/", line 75, in setupUI
File "/usr/share/anki/aqt/", line 584, in setupMainWindow
tweb = self.toolbarWeb = aqt.webview.AnkiWebView()
File "/usr/share/anki/aqt/", line 114, in __init__
AttributeError: 'NoneType' object has no attribute 'installEventFilter'

Steps to reproduce:

1. Update Arch to latest version
2. open Anki
This task depends upon

Closed by  Johannes Löthberg (demize)
Tuesday, 01 January 2019, 17:30 GMT
Reason for closing:  Fixed
Additional comments about closing:  Anki now officially supports non-outdated Qt versions.
Comment by michael Lojkovic (zerophase) - Saturday, 26 May 2018, 08:43 GMT
It has something to do with the initialization of Ankiwebview. I'm guessing something changed with QWebEngineView in 5.11.
Comment by Leo Vivier (Zaeph) - Sunday, 27 May 2018, 17:07 GMT

First time commenting on a bug report here, so please bear with me as I familiarise myself with the method.

I’ve tried downgrading the two packages listed as dependencies for Anki which I thought to be the culprit: python-pyqt5 & qt5-webengine. I’ve tried to disable them first separately and then together, and here are some tentative remarks:

1) Downgrading qt5-webengine didn’t change the behaviour mentioned in the report: Anki shows an error, fails to start, and is left running in the background. When run from a shell, the process doesn’t seem to output anything useful.
2) Downgrading python-pyqt5 prevents Anki from launching (i.e. it doesn’t even show the error box), which would seem to incriminate it.

I’ve included a log containing the back-trace when running Anki with a downgraded python-pyqt5, but it boils down to:

> Cannot mix incompatible Qt library (version 0x50a01) with this library (version 0x50b00)

So, apparently, you’d have to downgrade the entire Qt library to make it work.

   anki.log (3.1 KiB)
Comment by michael Lojkovic (zerophase) - Monday, 28 May 2018, 01:43 GMT
The issue is in QT 5.11 QWebEngineView::focusProxy() doesn't return a QQuickWidget by default. I managed to get Anki to successfully startup by modifying
class AnkiWebView(QWebEngineView):
fp = None

def __init__(self, parent=None):
if AnkiWebView.fp is None:
AnkiWebView.fp = QQuickWidget()

Though no cards show up now.
Comment by Farence (kotrfa) - Monday, 28 May 2018, 08:56 GMT
I tried to downgrade

qt5-base 5.10.1-8 5.10.1-8 0.00 MiB
qt5-declarative 5.11.0-1 5.10.1-4 2.54 MiB
qt5-location 5.11.0-1 5.10.1-2 -1.07 MiB
qt5-multimedia 5.11.0-1 5.10.1-1 -0.14 MiB
qt5-quickcontrols 5.11.0-1 5.10.1-1 1.92 MiB
qt5-sensors 5.11.0-1 5.10.1-1 0.00 MiB
qt5-svg 5.11.0-1 5.10.1-1 0.01 MiB
qt5-tools 5.10.1-1 17.05 MiB
qt5-webchannel 5.11.0-1 5.10.1-1 0.00 MiB
qt5-webengine 5.11.0-2 5.10.1-2 8.66 MiB
qt5-x11extras 5.11.0-1 5.10.1-1 0.00 MiB
qt5-xmlpatterns 5.11.0-1 5.10.1-1 -0.10 MiB
qt5-webkit 5.212.0alpha2-15 5.212.0alpha2-14 0.00 MiB
pyqt5-common 5.10.1-3 5.10.1-2 0.00 MiB
python-pyqt5 5.10.1-3 5.10.1-2 -0.07 MiB

and it helped now. If you urgently need that as a quick fix, you should be able to use the file above as `pacman -U $(cat pkgs.txt)`. Not ideal of course, since it can break your other qt5 software expecting 5.11. In my case, it's only anki though (or I don't care)
   pkgs.txt (0.9 KiB)
Comment by Johannes Löthberg (demize) - Monday, 28 May 2018, 20:08 GMT
I've pushed 2.1.0beta39-2 to cty-testing now which uses the upstream binary release since it's apparently completely incompatible with Qt 5.11.
Comment by leetking (alpha0x00) - Tuesday, 29 May 2018, 14:41 GMT
I use the lastest anki (2.1.0beta39-2) from community-testing. it can laucn, but I can't type chinese in any textbox.
I am sure that I can input chinese in anki (2.1.0beta39-1), when it can lauch correctly.

There is information below:
1. softwares
fcitx-rime 0.3.2-2
anki 2.1.0beta39-2
2. locale

3. I am sure through `htop` and typeing `e` on process `anki` that these enviroment variables are setting correctly.

At the last, I startup anki at the command line through a command, `LANG=zh_CN.UTF-8 anki`, and there is no difference.
Comment by michael Lojkovic (zerophase) - Thursday, 31 May 2018, 03:32 GMT
Almost have 5.11 working. Only thing is html keeps getting sent as a trash url to AnkiWebView::acceptNavigationRequest, and RequestHandler::send_head keeps getting an empty directory and favicon.ico whenever a deck gets selected.

The QT documentation doesn't mention much being being changed with QWebEngineView and related classes. Could this be a bug with PyQt5 with QT 5.11?
Comment by Antonio Rojas (arojas) - Thursday, 31 May 2018, 06:45 GMT
@zerophase no, this also happens with plain C++ Qt. See for how this was fixed in kontact, it may be useful here.
Comment by Johannes Löthberg (demize) - Saturday, 02 June 2018, 21:37 GMT
@alpha0x00: Could you try with 2.1.0beta40 in [community-testing]

As for the other Qt5.11 changes, I tested adding the same check to anki and it does make it open the links in the internal browser, but while clicking on a deck would change the bottom menu buttons, the main page stays the same. Not entirely sure what's going on there.
Comment by michael Lojkovic (zerophase) - Saturday, 02 June 2018, 21:47 GMT
@alpha0x00 I've been playing around with it for a few days. What's going on is the mediaserver GET request is getting incorrect paths when a deck is selected. (probably happens on other pages as well) I haven't been able to pin down exactly why it is happening, but believe it has something to do with QWebChannel passing incorrect information off to the server.

Replacing acceptNavigationRequest with a QWebEngineUrlRequestInterceptor appears to fix any side effects from acceptNavigationRequest getting hit. I won't know if that's necessary till we can pinpoint why incorrect paths are getting passed to the mediaserver.
Comment by leetking (alpha0x00) - Sunday, 03 June 2018, 01:48 GMT
@Kyrias I have tried 2.1.0beta40, and it has same problem with 2.1.0beta39 that I cant type chinese in a textbox.

@zerophase Thanks a lot, I'm not good at Python and have not used Qt, Hence sorry to don't know the reason of crash when it launch.
Is it possible to fix the issue at 2.1.0beta39 or 2.1.0beta40 builed from sources with Qt5.11?
Comment by michael Lojkovic (zerophase) - Wednesday, 06 June 2018, 05:13 GMT
Played around some more, and it looks like a threading issue.

QObject::setParent: Cannot set parent, new parent is in a different thread
QObject: Cannot create children for a parent that is in a different thread.
(Parent is AnkiQt(0x561b90243990), parent's thread is QThread(0x561b8f57aea0), current thread is QThread(0x7fc970366990)
QObject::startTimer: Timers can only be used with threads started with QThread

So, the Bridge::cmd is running on a separate thread when a deck is selected.
Comment by Kerrick Staley (KerrickStaley) - Thursday, 21 June 2018, 00:57 GMT
@zerophase: I'd also like to poke at the source to see if I can help fix this issue. Would you mind pushing your work-in-progress branch to GitHub or somewhere else that I can pull it from?
Comment by Karen Eliot (kareliot) - Thursday, 21 June 2018, 10:15 GMT
I don’t know why or since when but this seems to be fixed for me as Anki is starting normally again. Let me know if I can provide some further information
Comment by Farence (kotrfa) - Thursday, 21 June 2018, 10:51 GMT
Confirm. It works for me as well now. don't know what exactly caused the change though... Sorry
Comment by Farence (kotrfa) - Thursday, 21 June 2018, 10:51 GMT
Confirm. It works for me as well now. don't know what exactly caused the change though... Sorry
Comment by Johannes Löthberg (demize) - Thursday, 21 June 2018, 12:33 GMT
I would guess that it has something to do with Qt being updated to 5.11.1 yesterday, hm.
Comment by leetking (alpha0x00) - Sunday, 24 June 2018, 03:54 GMT
@Farence Which version of anki do you testify? I want to try it again, thanks.
The version 2.1.0beta40-1 is a binary from upstream, which works for me but cant input chinese.
Comment by michael Lojkovic (zerophase) - Sunday, 24 June 2018, 04:07 GMT
@kerrickstaley Just give me a day to clean everything up.
Comment by Farence (kotrfa) - Sunday, 24 June 2018, 06:55 GMT
Hey @leetking. It was anki 2.1.0beta40-1
Comment by leetking (alpha0x00) - Sunday, 24 June 2018, 14:41 GMT
@Farence, thanks a lot.
if it is installed by pacman and from repository, it works correctly, because it contains Qt dependencies owe to as a binary release.I have tried it, but it cant input chinese :sob:
Comment by Mateusz (Arvamer) - Sunday, 24 June 2018, 14:51 GMT
@leetking As a workaround, you may try to use ibus instead of fcitx. ibus-mozc works fine for me with anki from repo.
Comment by leetking (alpha0x00) - Monday, 25 June 2018, 09:57 GMT
@Mateusz thanks, but I prefer to user fcitx. I have tried and packaged the stable version of anki from the official binary just for me, and I still hope the lasted version can work.
I will wish it could be fixed and pay close attention to it.
Comment by michael Lojkovic (zerophase) - Wednesday, 27 June 2018, 22:51 GMT
@kerrickStaley Here you go.
Comment by bcahlit (bcahlit) - Saturday, 30 June 2018, 12:15 GMT
My still has an error, "AttributeError: 'NoneType' object has no attribute 'installEventFilter'"

I installed the official version because the current package is too big...

How does your software work?
Comment by michael Lojkovic (zerophase) - Wednesday, 04 July 2018, 15:22 GMT
@kerrickStaley Have any luck fixing the issue?
Comment by Andreas (misc) - Monday, 10 December 2018, 12:53 GMT
Today's 2.1.6 runs fine with qt 5.12 (using git/from source, not either binary version).

[Minor issue with the pkgbuild: mpv is missing as optional dependency for playback, Anki 2.1 prioritizes it over mplayer.]