Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyQt5 installation error (QtCore Module Error: Unable to create the C++ code)

I'm trying to install PyQt5 on my PC to have access to QtDesigner.

I'm facing following error during the installation:

$ python3 configure.py --qmake=/usr/local/Cellar/qt/5.10.1/bin/qmake --sip=/usr/local/Cellar/sip/4.19.8_2/bin/sip
Querying qmake about your Qt installation...
Determining the details of your Qt installation...
This is the GPL version of PyQt 5.7 (licensed under the GNU General Public License) for Python 3.6.3 on darwin.

......
DBus v1 does not seem to be installed.
Qt v5.10.1 is being used.
The qmake executable is /usr/local/Cellar/qt/5.10.1/bin/qmake.
Qt is built as a shared library.
SIP 4.19.8 is being used.
The sip executable is /usr/local/Cellar/sip/4.19.8_2/bin/sip.
The PyQt5 Python package will be installed in
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages.
PyQt5 is being built with generated docstrings.
PyQt5 is being built with 'protected' redefined as 'public'.
The Designer plugin will be installed in
/usr/local/Cellar/qt/5.10.1/plugins/designer.
The qmlscene plugin will be installed in
/usr/local/Cellar/qt/5.10.1/plugins/PyQt5.
The PyQt5 PEP 484 stub files will be installed in
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PyQt5.
The PyQt5 .sip files will be installed in
/Library/Frameworks/Python.framework/Versions/3.6/share/sip/PyQt5.
pyuic5, pyrcc5 and pylupdate5 will be installed in
/Library/Frameworks/Python.framework/Versions/3.6/bin.
The interpreter used by pyuic5 is python3.6.
Generating the C++ source for the QtCore module...
Error: Unable to create the C++ code.

Installation Environment:

macOS Sierra (version 10.12.6)

PyQt5 GPL 5.7

Qt 5.10

SIP 4.19.8

Two python versions, tried with both versions but same problem.

$ python --version
Python 2.7.14

$ python3 --version
Python 3.6.3

Followed readme instructions for the installation: Installed Qt using following:

$ brew install qt
Error: Xcode alone is not sufficient on Sierra.
Install the Command Line Tools:
 xcode-select --install

$ xcode-select --install
xcode-select: note: install requested for command line developer tools

$ brew install qt
Updating Homebrew...
==> Summary /usr/local/Cellar/qt/5.10.1: 9,375 files, 295.2MB

Then installed SIP using following:

$brew install sip
==> Installing dependencies for sip: gdbm, openssl, readline, sqlite, xz, python, python@2
==> Summary /usr/local/Cellar/sip/4.19.8_2: 16 files, 1.1MB

Update: Using --verbose option with configure command:

Generating the C++ source for the QtCore module...
/usr/local/Cellar/sip/4.19.8_2/bin/sip -w -f -t WS_MACX -t Qt_5_10_1 -B Qt_6_0_0 -P -o -y QtCore.pyi -c /Users/apple/Desktop/Python/PyQt5_gpl-5.7/QtCore -I sip -I /Users/apple/Desktop/Python/PyQt5_gpl-5.7/sip /Users/apple/Desktop/Python/PyQt5_gpl-5.7/sip/QtCore/QtCoremod.sip
sip: Deprecation warning: /Users/apple/Desktop/Python/PyQt5_gpl-5.7/sip/QtCore/QtCoremod.sip:23: %Module version numbers are deprecated and ignored
Error: Unable to create the C++ code.

Please advise how to solve this error.

Appreciate your support

like image 602
A.Midany Avatar asked Mar 07 '23 12:03

A.Midany


1 Answers

Managed to sort it out, the issue was related to the used SIP version.

I used SIP version compatible with PyQt5 5.7 which is SIP 4.18.1 and the problem was solved.

Next step:

$make

I faced another issue:

error: 'WindowOkButtonHint' : is not a member of 'Qt'
error: 'WindowCancelButtonHint' : is not a member of 'Qt'

To solve this I edited the ~/QtCore/sipQtCoreQt.cpp file and removed the 2 problematic lines.

http://patchwork.ozlabs.org/patch/720187/

like image 137
A.Midany Avatar answered Mar 09 '23 07:03

A.Midany