Nov 09
17
PyQt and Pydev in Eclipse on Snow Leopard
It’s been a while since I’ve done anything useful with Python, but just the other day I felt a sudden urge to pick it up again. I needed to get my old development environment with PyQt4 and Pydev up and running. I downloaded the latest version of Sip and PyQt from Riverbank, Qt (the mac-cocoa package) from Nokia and went through a straight forward install. After checking that I could import QtCore and QtGui in Idle, I installed the latest version of Pydev in Eclipse and opened one of my old projects…. Python crashed with the following error ‘Python quit unexpectedly while using the Qt.so plug-in’ and my project was filled with unresolved import errors. I thought that I had run into some 32- vs 64 bit issues, and started to build everything from source. I went through the whole install process several times building different versions of Qt from source and switching back and forth between 32 and 64 bit installs and Python versions, but no avail. After some late night Googling I found a post at Pydev’s tracker on Sourceforge suggesting to turn off code analysis in Pydev, due to a bug in PyQt4(I think). With code analysis off everything worked. I am not sure if it’s only because of the code analysis setting, or if it’s a mix of that and the versions of Qt, PyQt and Python I just happened to be running at the time. I have put together a list of what I installed and how. If you already have everything installed, but with different versions of the software, try and turn off code analysis. If that doesn’t help maybe this setup will. If you have some more info regarding these issues, please leave a comment.
Updated December 3, 2009
Nokia released Qt 4.6 December 1st, so I upgraded. I have now also upgraded sip to 4.9.3 and PyQt to 4.6.2. I did exactly the same steps as before, and I haven’t had any ‘Python crashes’ yet… Code completion of PyQt modules doesn’t work though.
Post is now updated to reflect the new releases of Qt, sip and PyQt.Any feedback is greatly appreciated. Does this work for you?
-Hersson-
Updated November 27, 2009
After using this setup for a few days I am sorry to say that this does NOT work. Python still quits ‘unexpectedly while using the Qt.so plug-in’. Maybe not as often, but the problem is still very much present. I apologies for spreading bogus info. If you know how to remedy this annoyance please leave a comment.Post will be updated as soon as I find or hear about a workaround.
-Hersson-
First of all I am running the Python 2.6.1 64 bit version shipped with Snow Leopard, and the 64 bit Cocoa version of Eclipse 3.5.1
Pre-phase
Download the qt-mac-cocoa-opensource-4.6.0.dmg binary from Nokia (this is the first version of Qt that officially supports Snow Leopard). Then sip-4.9.3.tar.gz and PyQt-mac-gpl-4.6.2.tar.gz from Riverbank,
Qt
I did a default install, but without the examples and documentation.
SIP
tar zxvf sip-4.9.3.tar.gz cd sip-4.9.3 python configure.py --arch=x86_64 make sudo make install
PyQt4
tar zxvf PyQt-mac-gpl-4.6.2.tar.gz cd PyQt-mac-gpl-4.6.2 python configure.py --use-arch=x86_64 -q /usr/bin/qmake make sudo make install
Pydev
Start Eclipse and go to Help -> Install New Software. Add http://pydev.org/updates, and install the latest version (1.5.1 as of writing).
Then setup your python interpreter, Auto Config should go right and choose 2.6.
Now disable code analysis: Open Eclipse Preferences -> Pydev -> Editor -> Code Analysis and uncheck Do code analysis?






