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

Flavio fbdiom at gmail.com
Thu Mar 10 23:37:54 GMT 2011

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)

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 -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 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)

'PyQt Test',
'<center><font size=+1><b>Basic About Box</b></font><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,

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-packages/PyQt4/QtCore.so

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? if so, are there any recommendations about how to overcome the initial failure in building PyQt?

Flavio | fbdiom at gmail.com

More information about the PyQt mailing list