after upgrading to Ubuntu 16.10 from 16.04, Anki program does not run. this is the error message:

Traceback (most recent call last):
  File "/usr/bin/anki", line 7, in <module>
    import aqt
  File "/usr/share/anki/aqt/__init__.py", line 12, in <module>
    from aqt.qt import *
  File "/usr/share/anki/aqt/qt.py", line 22, in <module>
    from PyQt4.QtWebKit import QWebPage, QWebView, QWebSettings
ImportError: No module named QtWebKit
  • Whoever has given close vote to it, Ubuntu 16.10 has been released officially yesterday. It's not off-topic now – Anwar Oct 14 '16 at 12:49
  • Please read the note about it at ankisrs.net – user589808 Oct 14 '16 at 13:31
  • @CelticWarrior how can i install Qt4/WebKit in Ubuntu 16.10 – Saeed Zarinfam Oct 14 '16 at 13:44
  • @SaeedZarinfam Have you tried the "somewhere else", which points to snapshot.debian.org/package/python-qt4/4.11.4%2Bdfsg-1/… ? Their other suggestion is to use Anki for Windows with Wine until they fix it to work with the new kit. – user589808 Oct 14 '16 at 13:48
  • ... until they fix it to work .... was written in Oct 2016. Now it is Nov 2017, same problem ... :-( – guettli Nov 22 '17 at 19:22

Simple solution (pre-compiled build)

The latest Anki releases are now available as compiled static builds which ship with all dependencies included. They should work right out of the box on most Linux distros.

Advanced solution (using source code tarball)

In some instances it might be necessary to run Anki from source, e.g. when developing an add-on or playing around with Anki's code. In those cases the following should work:

  1. Make sure you have all of Anki's dependencies satisfied (either by looking at the package dependencies and manually installing them, or by installing Anki from the official repositories in order to fetch its dependencies)
  2. Download the latest Anki 2.0.x source tarball from Anki's homepage and extract it
  3. Download the Debian Jessie version of python-qt4, as pointed out by davidbragat below, and extract it
  4. Find the PyQt4 folder located in the extracted python-qt4 debfile and move it to the extracted Anki source folder. In the end, the PyQt4 folder and runanki script should reside next to each other.
  5. Edit runanki in Anki's source folder and change

    import sys
    sys.path.insert(0, "/usr/share/anki")


    #import sys
    #sys.path.insert(0, "/usr/share/anki")
  6. cd to Anki's source code folder and run ./runanki. Anki should now launch.

  • 1
    If you're going to do this you may as well sudo apt remove anki first. – Zaz Feb 20 '17 at 20:10
  • Agreed, if it's broken due to an Ubuntu update, Ubuntu clearly aren't testing their debs. Better to use the upstream source. – rjh Apr 5 '17 at 8:21
  • This is the most simple way to fix it. – tokam May 11 '17 at 12:23

I got Anki working again by installing python-qt4 from Jessie. I downloaded it from https://packages.debian.org/jessie/python-qt4 (scroll down to the bottom of the page for download links.. most will choose amd64)

and installed it via sudo dpkg -i python*.deb

Credits: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=826727 by Thomas Rebele

  • After installing python-qt4, Ubuntu show update dialog for python qt binding and after update the problem occurs again. – Saeed Zarinfam Oct 15 '16 at 7:14
  • I tried to follow your solution and what aptitude prepares to do sounds shocking. It tries to remove all my importantant packages? Vorkonfiguration der Pakete ... (Lese Datenbank ... 1518460 Dateien und Verzeichnisse sind derzeit installiert.) Entfernen von alacarte (3.11.91-2) ... Entfernen von anki (2.0.32+dfsg-1) ... Entfernen von asymptote (2.38-2build1) ... Entfernen von atom (0.209.0) ... Entfernen von avahi-discover (0.6.32-1ubuntu1) ... ....... to be followed by mate and many more, essentially all my programs installed are propsed to be removed or actually removed – tokam Oct 16 '16 at 8:05
  • 1
    It will delete your system. Dropbox, Anki, Playonlinux and many more programs – tokam Oct 16 '16 at 8:25
  • Here a list of packages that got deleted by this .deb installation: pastebin.com/kKzUyK33 – tokam Oct 16 '16 at 8:46
  • 1
    I first installed from gdebi and it did not allow me because a newer version is available. however, it said a newer version was already in place and refused.. then I did the dpkg for better or worse .. it worked.. The list of removed apps did not affect me.. for instance calibre still works. What is disturbing is that I had done this process before.. therefore an upgrade overwrote this package with an nonworking python library. So you may have to do this several times.. which might be dangerous to other python software. – Bhikkhu Subhuti Dec 15 '16 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.