1

I'm trying to install Ghost.py in CentOS 7. I've installed the packages below, but it appears that I've missed something, or a path is not available somewhere. I'm really struggling here, and not sure what I've missed.

sudo yum install cmake qconf qt-devel qt4-devel python-devel PyQt4 PyQt4-devel PyQt4-web* xorg-x11-server-ver-Xvfb python-xvfbwrapper
sudo ln -s /usr/bin/qmake-qt4 /usr/bin/qmake

Then installed PySide

sudo pip install PySide
sudo pip install Ghost.py

Then in my interpreter when I go to import it, I get this:

Python 2.7.5 (default, Jun 24 2015, 00:41:19) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ghost import Ghost
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/ghost/__init__.py", line 2, in <module>
    from .ghost import (
  File "/usr/lib/python2.7/site-packages/ghost/ghost.py", line 17, in <module>
    from .bindings import (
  File "/usr/lib/python2.7/site-packages/ghost/bindings.py", line 74, in <module>
    QtWebKit = _import('QtWebKit')
  File "/usr/lib/python2.7/site-packages/ghost/bindings.py", line 41, in _import
    module = __import__(name)
ImportError: No module named QtWebKit

I don't understand this, because it's in my /usr/lib64/python2.7/site-packages/PyQt4 directory:

[me@localhost PyQt4]$ ls -lah
total 16M
drwxr-xr-x.  3 root root 4.0K Sep 21 13:56 .
drwxr-xr-x. 43 root root 8.0K Sep 21 13:56 ..
-rw-r--r--.  1 root root 1.1K Jun  9  2014 __init__.py
-rw-r--r--.  2 root root  139 Jun  9  2014 __init__.pyc
-rw-r--r--.  2 root root  139 Jun  9  2014 __init__.pyo
-rwxr-xr-x.  1 root root 406K Jun  9  2014 phonon.so
-rw-r--r--.  1 root root  14K Jun  9  2014 pyqtconfig.py
-rw-r--r--.  2 root root  17K Jun  9  2014 pyqtconfig.pyc
-rw-r--r--.  2 root root  17K Jun  9  2014 pyqtconfig.pyo
-rwxr-xr-x.  1 root root 2.7M Jun  9  2014 QtCore.so
-rwxr-xr-x.  1 root root 236K Jun  9  2014 QtDBus.so
-rwxr-xr-x.  1 root root 267K Jun  9  2014 QtDeclarative.so
-rwxr-xr-x.  1 root root 354K Jun  9  2014 QtDesigner.so
-rwxr-xr-x.  1 root root 8.3M Jun  9  2014 QtGui.so
-rwxr-xr-x.  1 root root 125K Jun  9  2014 QtHelp.so
-rwxr-xr-x.  1 root root 148K Jun  9  2014 QtMultimedia.so
-rwxr-xr-x.  1 root root 771K Jun  9  2014 QtNetwork.so
-rwxr-xr-x.  1 root root 302K Jun  9  2014 QtOpenGL.so
-rwxr-xr-x.  1 root root 218K Jun  9  2014 QtScript.so
-rwxr-xr-x.  1 root root  27K Jun  9  2014 QtScriptTools.so
-rwxr-xr-x.  1 root root 6.8K Jun  9  2014 Qt.so
-rwxr-xr-x.  1 root root 347K Jun  9  2014 QtSql.so
-rwxr-xr-x.  1 root root  99K Jun  9  2014 QtSvg.so
-rwxr-xr-x.  1 root root  36K Jun  9  2014 QtTest.so
-rwxr-xr-x.  1 root root 472K Mar 31  2014 QtWebKit.so
-rwxr-xr-x.  1 root root 179K Jun  9  2014 QtXmlPatterns.so
-rwxr-xr-x.  1 root root 346K Jun  9  2014 QtXml.so
drwxr-xr-x.  6 root root 4.0K Sep 21 13:56 uic
mudda
  • 274
  • 3
  • 14
  • So is `/usr/lib` the same directory as `/usr/lib64`? – ekhumoro Sep 22 '15 at 02:53
  • It's not, good catch, and I noticed that last night doing more digging, and didn't want to post here until I figure out what the culprit is. I'm not sure why pip sometimes installs to `/usr/lib` and then sometimes to `/usr/lib64`. If I uninstall/reinstall a package, it occasionally will switch. I can't reproduce it every time. Not sure why this happens. – mudda Sep 22 '15 at 11:22
  • You seem to have two python-2.7 installations. The one in `/usr/lib64` is the system one (i.e. where yum installs packages), whilst the one under `/usr/lib` is one you must have installed yourself. Although the libs are in different directories, the executables are probably both installed in `/usr/bin`. So every time you upgrade/re-install python-2.7, the files in `/usr/bin` (which probably includes `pip`) will get overwritten. – ekhumoro Sep 22 '15 at 15:16
  • No, I only have one python install. – mudda Sep 22 '15 at 20:37
  • The output from the interpreter session shows that python is trying to import from `/usr/lib/python2.7/site-packages`. What is your `$PYTHONPATH`? – ekhumoro Sep 22 '15 at 21:36

1 Answers1

0

PyQt4 is in your site-packages, and that is therefore the package that you have to import. If you specifically want to import QtWebKit from the PyQt4 package, that's what you'll have to do

from PyQt4 import QtWebKit
ewil
  • 529
  • 1
  • 4
  • 4