Install old version PyQt4 on a mac by compiling the source

Felix Voigt info at felibunda.eu
Sat Jul 10 11:16:16 BST 2021


> On 9. Jul 2021, at 10:09, Phil Thompson <phil at riverbankcomputing.com> wrote:
> 
> On 08/07/2021 19:37, Felix Voigt wrote:
>> Hello everyone,
>> today I tried the same with PyQt5 with the following results.
>> The configure process succeeded:
>> cd ~/documents/tmp/PyQt5-5.15.4
>> ~/.pyenv/versions/2.7.18/bin/python2.7 configure.py --qmake
>> /usr/local/Cellar/qt at 5/5.15.2/bin/qmake
>> --sip=/Users/felixvoigt/.pyenv/versions/2.7.18/bin/sip --verbose
>> The make process failed:
>> make
>> -> In file included from
>> /Users/felixvoigt/documents/tmp/PyQt5-5.15.4/sip/QtCore/qsocketnotifier.sip:26:
>> /usr/local/Cellar/qt at 5/5.15.2/lib/QtCore.framework/Headers/qsocketnotifier.h:117:35:
>> error: constexpr function never produces a constant
>>      expression [-Winvalid-constexpr]
>>    Q_DECL_CONSTEXPR_NOT_WIN bool isValid() const noexcept { return
>> *this != QSocketDescriptor(); }
>>                                  ^
>> /usr/local/Cellar/qt at 5/5.15.2/lib/QtCore.framework/Headers/qsocketnotifier.h:117:75:
>> note: undefined function 'operator!=' cannot be used
>>      in a constant expression
>>    Q_DECL_CONSTEXPR_NOT_WIN bool isValid() const noexcept { return
>> *this != QSocketDescriptor(); }
>>                                                                          ^
>> /usr/local/Cellar/qt at 5/5.15.2/lib/QtCore.framework/Headers/qsocketnotifier.h:124:42:
>> note: declared here
>>    friend Q_DECL_CONSTEXPR_NOT_WIN bool operator!=(QSocketDescriptor lhs,
>> 1 error generated.
>> Any ideas how to fix it?
>> Kind regards
>> feli_x
> 
> As the error is referring to Qt source code and not SIP generated code then the problem may be your version of Xcode.
> 
> Phil


Hello Phil and thanks,

meanwhile I updated my xcode from beta 9.0 to 11.3.1. 
I managed to configure pyqt5 via:
~/.pyenv/versions/2.7.18/bin/python2.7 configure.py --qmake /usr/local/Cellar/qt at 5/5.15.2/bin/qmake --sip=/Users/felixvoigt/.pyenv/versions/2.7.18/bin/sip —verbose

Although there was a warning, which I neglected:
Project WARNING: Qt requires at least version 10.14 of the platform SDK, you're building against version 10.13. Please upgrade.

The make process succeeded, there were also many warnings, which are too many to store them I thought.

Finally:
make install

Now, my next problem is, if I start the python program, the line "from PyQt5 import QtCore, QtGui” gives an error message:
~/.pyenv/versions/2.7.18/bin/python2.7 test.py 
Traceback (most recent call last):
 File "test.py", line 1, in <module>
   from PyQt5 import QtCore, QtGui
ImportError: No module named sip

I tried including the folder /Users/felixvoigt/.pyenv/versions/2.7.18/bin in my PATH, which was not a solution.

Does somebody know how to configure sip correctly such that it can be found by pyqt5?

Regards
feli_x


More information about the PyQt mailing list