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
HOKU
  • 31

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)

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

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
  • 78,878
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
  • 240