2

I manually installed PyQt-4.9.1 and sip-4.13.2 under /tmp/yifli because the ones currently installed on the machine (running Fedora 13) are too old for my software.

After that, I added their locations to $PYTHONPATH and here is the output of sys.path:

>>> import sys
>>> print sys.path
['', '/tmp/yifli/lib/python/site-packages', '/tmp/yifli/lib/python/site-packages/PyQt4',    '/usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/Numeric', '/usr/lib/python2.6/site-packages/PIL', '/usr/lib/python2.6/site-packages/gst-0.10', '/usr/lib/python2.6/site-packages/gtk-2.0', '/usr/lib/python2.6/site-packages/scim-0.1', '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info', '/usr/lib/python2.6/site-packages/webkit-1.0']

However, the error I got is due to the fact that somehow the old PyQt4 is still being used:

>>> import sip
>>> sip.__file__
'/tmp/yifli/lib/python/site-packages/sip.so'
>>> import PyQt4
>>> PyQt4.__file__
'/usr/lib/python2.6/site-packages/PyQt4/__init__.pyc'

How come?

P.S., I did get errors when I compiled Qt which complained some header file for Qt Phonon module cannot be found. But since I don't use that module, I just ignored it.

Yifei

user11869
  • 1,083
  • 2
  • 14
  • 29
  • I noticed that __init_.pyc and pyqtconfig.pyc are missing from /tmp/yifli/lib/python/site-packages/PyQt4 – user11869 Feb 17 '12 at 19:15
  • oh, this is probably caused by the error I had during the 'make' phase of PyQt4 – user11869 Feb 17 '12 at 19:16
  • the error is /tmp/yifli/PyQt-x11-gpl-4.9.1/sip/phonon/abstractaudiooutput.sip:33:33: error: abstractaudiooutput.h: No such file or directory – user11869 Feb 17 '12 at 19:16

1 Answers1

1

Firstly, installing things in /tmp is not a good idea, because it is intended only for temporary files (most systems will be set up to remove everything in /tmp during the boot or shutdown process).

Secondly, you should NEVER attempt to modify your system python or any of its packages - this will almost certainly lead to breakage of other applications that depend on python. If you need a different version of python and/or its packages, create a completely separate installation under /usr/local.

With that in place, you just need to ensure that your new python is specified whenever you are compiling packages for it.

So, to compile Sip you would do:

/usr/local/bin/python sip_source/configure.py

And for PyQt4, you would do the same - but also add a couple of other options that should avoid over-writing system files:

/usr/local/bin/python pyqt4_source/configure.py \
--qsci-api-destdir /usr/local/lib/qt4/qsci --no-designer-plugin

Once this has been set up, you can then create a simple wrapper script for running applications that need the upgraded python:

#!/bin/sh
exec /usr/local/bin/python myapp.py "$@"

Note that you do not need to change $PYTHONPATH for any of this to work, and so you should undo any changes you have made to it. (And you might also want to consider re-installing your fedora sip and pyqt packages to ensure everything is put back the way it was).

As for the errors regarding Phonon, the solution is simple: if the header files are missing, install the fedora package that contains them.

ekhumoro
  • 115,249
  • 20
  • 229
  • 336
  • I know /tmp should only be used for temporary files, but I can't wait for our sys admin to upgrade PyQt for me. I did not modify any system python packages, sip and pyqt are all installed under /tmp. – user11869 Feb 18 '12 at 01:47
  • 1
    @user11869. If you don't have root privileges, then just use a directory in `$HOME` rather than `/usr/local`. Using `/tmp` is unnecessary and just plain wrong. – ekhumoro Feb 18 '12 at 02:02
  • --qsci-api-destdir, I think only two min (--) there. – chhantyal Aug 03 '13 at 18:26