Discussion:
[PyQt] Qt classes not available
Glenn Ramsey
2018-11-16 03:59:01 UTC
Permalink
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
_______________________________________________
PyQt mailing list ***@riverbankcomputing.com
https://www.riverban
Barry
2018-11-16 15:38:41 UTC
Permalink
Post by Glenn Ramsey
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.
FYI: See https://wiki.python.org/moin/WindowsCompilers for the compiler version to use with 2.7 on windows. VS2017 is too new. Microsoft provides visual studio for python 2.7 because of the compatibility issues if you newer compilers.

Barry
Post by Glenn Ramsey
PyQt doesn't seem to be wrapping the Qt objects as they do not appear to be
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
File "<pyshell#1>", line 1, in <module>
from PyQt5.QtCore import QTimer
ImportError: No module named sip
import sip
from PyQt5.QtCore import QTimer
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
_______________________________________________
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Phil Thompson
2018-11-16 16:56:46 UTC
Permalink
Post by Glenn Ramsey
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
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
File "<pyshell#1>", line 1, in <module>
from PyQt5.QtCore import QTimer
ImportError: No module named sip
import sip
from PyQt5.QtCore import QTimer
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.
Then you probably need to update your build process...

https://pyqt.readthedocs.io/en/latest/installation.html#downloading-sip
http://pyqt.sourceforge.net/Docs/sip4/using.html#ref-private-sip
Post by Glenn Ramsey
Do I need to also build Python myself using VS2017?
Phil
_______________________________________________
PyQt mailing list ***@riverbankcomputing.com
https://w
Glenn Ramsey
2018-11-19 20:37:04 UTC
Permalink
Hi Phil,
Post by Phil Thompson
Post by Glenn Ramsey
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
Any ideas why this might be? I've been following this build process for years
and never had an issue like this before.
Then you probably need to update your build process...
https://pyqt.readthedocs.io/en/latest/installation.html#downloading-sip
http://pyqt.sourceforge.net/Docs/sip4/using.html#ref-private-sip
Configuring using the necessary --sip-module parameter fixed it, thanks:

python configure.py --sip-module PyQt5.sip --no-tools

Knowing what I was looking for I was unable to find any mention of this in the
downloaded distributions for either PyQt5 or sip and would never have thought to
look on readthedocs.io.

I think it would be worth noting this in the README or NEWS files. However even
if it was there I probably wouldn't have found it, so perhaps it would be useful
to have a message appear on the console after configure.py has run to highlight
this change? E.g. " we notice you're using PyQt 5.11 but haven't used the
--sip-module flag - see <link to docs>"

Glenn
_______________________________________________
PyQt mailing list ***@riverbankcomputing.com

Loading...