I'm trying to run anki
on CentOS and get the following error:
Traceback (most recent call last):
File "/usr/bin/anki", line 5, in <module>
import aqt
File "/usr/share/anki/aqt/__init__.py", line 5, in <module>
from aqt.qt import *
File "/usr/share/anki/aqt/qt.py", line 13, in <module>
from PyQt4.QtWebKit import QWebPage, QWebView, QWebSettings
ImportError: No module named QtWebKit
I have installed the following packages:
qtwebkit-2.1.1-1.el6.i686
qtwebkit-2.1.1-1.el6.x86_64
qtwebkit-devel-2.1.1-1.el6.x86_64
but Anki
still crashes.
I searched on forums and found that I need to check the place where Python searches for this module:
>>> import PyQt4
>>> print PyQt4.__path__
['/usr/lib64/python2.6/site-packages/PyQt4']
In my case, this folder contains some .so
files, but no QtWebKit.so
.
I searched the filesystem for this file and found some matches, although I'm not sure it's what Python needs:
/usr/lib/libQtWebKit.so.4
/usr/lib/libQtWebKit.so.4.8.1
/usr/lib/libQtWebKit.so.4.8
/usr/lib64/libQtWebKit.so.4
/usr/lib64/libQtWebKit.so.4.8.1
/usr/lib64/libQtWebKit.so.4.8
How can I fix this problem?
Unfortunately I don't have permission to modify /usr/lib64
folder, so I need to tell Python where to get required .so
file from.
It appears that the official CentOS PyQt4 packages don't include the QtWebKit module (not even in the latest release).
However, there do seem to be separate PyQt4 webkit packages available elsewhere. Probably the best way to get them is to add one of the Community Approved Repositories to yum.
The Extra Packages for Enterprise Linux (EPEL) has the PyQt4-webkit package you want. Apparently, this repository is included with CentOS Extras, and should be enabled by default. But if it isn't, you can enable it with:
yum install epel-release
And then do:
yum install PyQt4-webkit