3

I've installed Anki from "Ubuntu software" and as an addition installed this: sudo apt-get install python3-distutils (because of known issue) and it still doesn't work. Could someone please explain to me what should I do to fix the problem?

Upd1: After launching from terminal (as @Emmet asked) the output is here:

su@uranus:~$ anki
Traceback (most recent call last):
  File "/usr/bin/anki", line 6, in <module>
    import aqt
  File "/usr/share/anki/aqt/__init__.py", line 32, in <module>
    import aqt.forms
  File "/usr/share/anki/aqt/forms/__init__.py", line 44, in <module>
    from . import about
  File "/usr/share/anki/aqt/forms/about.py", line 42, in <module>
    from aqt.webview import AnkiWebView
  File "/usr/share/anki/aqt/webview.py", line 90, in <module>
    class AnkiWebView(QWebEngineView):
NameError: name 'QWebEngineView' is not defined
SurvivalMachine
  • 2,773
  • 6
  • 20
  • 32
  • Launch it from terminal, paste the output here. – Liso Apr 21 '19 at 11:43
  • @Emmet added an output to the body – Zanuda Duda Apr 21 '19 at 11:59
  • See https://askubuntu.com/a/1123878/66509 for links. You can request package build for Disco or grab package from cosmic manually [from link](https://launchpad.net/~torkvemada/+archive/ubuntu/torkvemada/+files/anki_2.1.7+dfsg-1cosmic1_all.deb). – N0rbert Apr 21 '19 at 14:00
  • This is a bug and should be reported at https://bugs.launchpad.net/ubuntu – raindev May 19 '19 at 16:01

5 Answers5

3

The only problem here is a forgotten import in the Python script mentioned at the bottom of the traceback :

    File "/usr/share/anki/aqt/webview.py", line 90, in <module>
      class AnkiWebView(QWebEngineView):
NameError: name 'QWebEngineView' is not defined

Just open webview.py and add the import needed:

from PyQt5.QtWebEngineWidgets import *

(There are a bunch of other imports missing from QtWebEngineWidgets aside from QWebEngineView, so it's easier to just import them all)

Peckingjay
  • 31
  • 1
  • 1
    This is already in the works for being fixed - see my answer and the attached bug. A fix was already released in Eoan (devel release), its pending SRU team intervention to release in disco-updates – Thomas Ward Jul 09 '19 at 13:31
2

I've the same problem today :D this the steps how i fixed it

First remove anki:

sudo apt-get remove anki
sudo apt-get autoremove
sudo apt-get update

Second install anki from this steps https://apps.ankiweb.net/

1) Downloads Anki from website

https://apps.ankiweb.net/downloads/current/anki-2.1.11-linux-amd64.tar.bz2

2) Installation

tar xjf anki-2.1.11-amd64.tar.bz2
cd anki-2.1.11-linux-amd64
sudo make install

3) to run anki

use this /usr/local/share/anki/bin/anki write it on terminal

Or

sudo nano /usr/bin/anki

and write in /usr/bin/anki file this code

#!/usr/bin/bash
/usr/local/share/anki/bin/anki

save file and write on terminal

sudo chmod -R 755 /usr/bin/anki

now you can run anki just when you write anki on terminal

congratulation :D

1

You're not importing QWebPage.

Try adding this import to the top of your script:

from PyQt5.QtWebKitWidgets import QWebPage

Source: https://stackoverflow.com/questions/41754786/nameerror-name-qwebpage-is-not-defined

Philippe Delteil
  • 1,628
  • 1
  • 17
  • 31
  • 1
    There is no user script involved, only a package installed with apt from the Ubuntu repository. – raindev May 19 '19 at 16:02
0

This is a KNOWN BUG and is already in the process of being fixed.

I have already uploaded a fix to the repos for this. It awaits SRU team release into the disco-updates pocket of the repositories.

More details at: https://bugs.launchpad.net/ubuntu/+source/anki/+bug/1825722

Thomas Ward
  • 72,494
  • 30
  • 173
  • 237
0

FYI, a fix was released as of 19.04. So the workaround shouldn't be necessary from now on. Still, the upstream Debian package seems to be barely maintained and affected by the same bug.

memeplex
  • 200
  • 1
  • 7