[PyQt] Qt classes not available

Glenn Ramsey gr at componic.co.nz
Fri Nov 16 03:59:01 GMT 2018


Hi,

I have built PyQt5 (PyQt5_commercial-5.12.dev1810261601 or
PyQt5_commercial-5.11.3) against a development version of Qt 5.12 from git and
Python 2.7.15 on Windows10 using VS2017. I've tried sip 4.19.13 and
sip-4.19.14.dev1810291324. Building and installing appears to have completed
without errors.

PyQt doesn't seem to be wrapping the Qt objects as they do not appear to be
available in the PyQt5 namespace as shown in the following output:

Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit
(AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import PyQt5
>>> from PyQt5.QtCore import QTimer

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    from PyQt5.QtCore import QTimer
ImportError: No module named sip
>>> import sip
>>> from PyQt5.QtCore import QTimer

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    from PyQt5.QtCore import QTimer
ImportError: cannot import name QTimer
>>> dir(PyQt5.QtCore)
['QT_TRANSLATE_NOOP', 'QT_TR_NOOP', 'QT_TR_NOOP_UTF8', 'Q_ARG', 'Q_CLASSINFO',
'Q_ENUM', 'Q_ENUMS', 'Q_FLAG', 'Q_FLAGS', 'Q_RETURN_ARG', '__doc__', '__name__',
'__package__', 'bin_', 'bom', 'center', 'dec', 'endl', 'fixed', 'flush',
'forcepoint', 'forcesign', 'hex_', 'left', 'lowercasebase', 'lowercasedigits',
'noforcepoint', 'noforcesign', 'noshowbase', 'oct_', 'pyqtPickleProtocol',
'pyqtRemoveInputHook', 'pyqtRestoreInputHook', 'pyqtSetPickleProtocol',
'pyqtSlot', 'qAbs', 'qAddPostRoutine', 'qAddPreRoutine', 'qChecksum',
'qCompress', 'qCritical', 'qDebug', 'qEnvironmentVariable', 'qErrnoWarning',
'qFatal', 'qFloatDistance', 'qFormatLogMessage', 'qFuzzyCompare', 'qInf',
'qInfo', 'qInstallMessageHandler', 'qIsFinite', 'qIsInf', 'qIsNaN', 'qIsNull',
'qQNaN', 'qRegisterResourceData', 'qRemovePostRoutine', 'qRound', 'qRound64',
'qSNaN', 'qSetFieldWidth', 'qSetMessagePattern', 'qSetPadChar',
'qSetRealNumberPrecision', 'qSharedBuild', 'qUncompress',
'qUnregisterResourceData', 'qVersion', 'qWarning', 'qrand', 'qsrand', 'reset',
'right', 'scientific', 'showbase', 'uppercasebase', 'uppercasedigits', 'ws']
>>>

Any ideas why this might be? I've been following this build process for years
and never had an issue like this before.

Do I need to also build Python myself using VS2017?

Glenn


More information about the PyQt mailing list