[PyQt] Unable to configure and run PyQt in OSX 10.6

Hans-Peter Jansen hpj at urpla.net
Fri Mar 11 00:08:12 GMT 2011

On Friday 11 March 2011, 00:37:54 Flavio wrote:
> Hello -
> I am a new PyQT user, experimenting with the toolset. I installed the
> following components in a OSX 10.6 system:
> python-2.7.1-macosx10.3 (32-bit)
> qt-mac-opensource-4.7.2
> qt-mac-opensource-4.7.2-debug-libs
> PyQt-mac-gpl-4.8.3
> sip-4.12.1
> The SIP installation went through without issues, but I was not able
> to build PyQt. make install would fail here:
> g++ -c -pipe -fPIC -O2 -Wall -W -DNDEBUG -DSIP_PROTECTED_IS_PUBLIC
> -Dprotected=public -DQT_NO_DEBUG -DQT_CORE_LIB -I.
> -I/Users/flavio/Downloads/PyQt-mac-gpl-4.8.3/qpy/QtCore
> -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
> -I/mkspecs/macx-g++ -I/Library/Frameworks/QtCore.framework/Headers
> -I/usr/include
> -F/Users/flavio/Downloads/PyQt-mac-gpl-4.8.3/qpy/QtCore
> -F/Library/Frameworks -o sipQtCoreQt.o sipQtCoreQt.cpp g++ -c -pipe
> -Dprotected=public -DQT_NO_DEBUG -DQT_CORE_LIB -I.
> -I/Users/flavio/Downloads/PyQt-mac-gpl-4.8.3/qpy/QtCore
> -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
> -I/mkspecs/macx-g++ -I/Library/Frameworks/QtCore.framework/Headers
> -I/usr/include
> -F/Users/flavio/Downloads/PyQt-mac-gpl-4.8.3/qpy/QtCore
> -F/Library/Frameworks -o sipQtCoreQSysInfo.o sipQtCoreQSysInfo.cpp
> g++ -headerpad_max_install_names -bundle -undefined dynamic_lookup -o
> QtCore.so
> with this error:
> ld: library not found for -lqpycore
> collect2: ld returned 1 exit status
> make[1]: *** [QtCore.so] Error 1
> make: *** [install] Error 2
> I eventually tracked down an issue here: See:
> http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg17303.html
>. That says that the inc_path is incorrect: inc_path =
> [sipcfg.py_inc_dir], and should be changed to this: inc_path =
> [sipcfg.py_inc_dir, sipcfg.sip_inc_dir].
> Once I made this change, I got an incorrect ARCH error (arch=x86_64).
> SO I reconfigured and reinstalled SIP and PyQT selecting arch=i386
> during configure.py. That resulted in a successful build and
> installation.
> Now, I am testing this small program:
> import sys
> import platform
> from PyQt4.QtCore import *
> from PyQt4.QtGui import *
> app = QApplication(sys.argv)
> QMessageBox.information(app.parent(),
> 'PyQt Test',
> '<center><font size=+1><b>Basic About Box</b></font><br>'
> 'Test</center><br><br>'
> 'An application to demonstrate GUI programming with Python and
> Qt.<br><br>' 'Uses Python v%s with Qt v%s and PyQt v%s on %s.' %
> (platform.python_version(), QT_VERSION_STR, PYQT_VERSION_STR,
> platform.system()))
> This fails with this message:
> Traceback (most recent call last):
> File "/Users/flavio/pycon/PyQt/pyqt-I/01-about_box/about_box.py",
> line 4, in <module> from PyQt4.QtCore import *
> ImportError:
> dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.
>7/site-packages/PyQt4/QtCore.so, 2): Symbol not found: _sipQtConnect
> Referenced from:
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
>packages/PyQt4/QtCore.so Expected in: flat namespace
> in
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-

Your errors doesn't make any sense to me: the lib tries to dlopen 
itself, _and_ bails out with a symbol not found message. Strange.  

> It seems that I still have in incorrectly built or configure
> environment. Any advice here would be welcome. Should I remove
> everything and start over?

Likely the best idea. Clean up _every_ bit of Qt and PyQt in the system 
dirs and start over.

> if so, are there any recommendations about 
> how to overcome the initial failure in building PyQt?

Well, Macs are always a bit different - and differences between major 
releases only contribute to the mess. Usually, you're able to build fat 
binaries (that support both archs), but you need to read into the Qt 
docs, how your version is build, and prepare your sip/PyQt builds 
accordingly. (It's been a while, since I've built things on OSX, and 
such knowledge rots quicker then anywhere else...)

Good luck,

More information about the PyQt mailing list