Install old version PyQt4 on a mac by compiling the source

Felix Voigt info at
Wed Jul 14 06:39:02 BST 2021

> On 13. Jul 2021, at 23:01, Phil Thompson <phil at> wrote:
> On 13/07/2021 21:39, Felix Voigt wrote:
>>> On 10. Jul 2021, at 12:29, Phil Thompson <phil at> wrote:
>>> On 10/07/2021 11:16, Felix Voigt wrote:
>>>>> On 9. Jul 2021, at 10:09, Phil Thompson <phil at> 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 --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 --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
>>>> Traceback (most recent call last):
>>>> File "", 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?
>>> Phil
>> Hello again,
>> thanks for the answer.
>> If I take the PyQt5_sip-12.9.0.tar.gz version downloaded from
>>, I obtain the following:
>> After the commands
>> cd ~/documents/tmp/PyQt5_sip-12.9.0
>> ~/.pyenv/versions/2.7.18/bin/python2.7  build
>> the following error results:
>> In file included from ./sipint.h:26:
>> ./sip.h:28:2: error: "This version of SIP requires Python v3.5 or later"
>> #error "This version of SIP requires Python v3.5 or later”
>> Is there a version of PyQt5_sip which is applicable to python2.7? And
>> by the way, do I need sip or PyQt5_sip, and what is the difference?
>> Sorry for many questions,
>> best regards
> My apologies (Python v2 is no longer supported), you probably need to use SIP v4 (also no longer supported) which you can find here...
> Phil

Dear Phil,

thanks. I already had compile sip4.19.25, but PyQt5.15.4 did not find the module.
On the site I found the solution. I have to configure sip with the option --sip-module=PyQt5.sip.
In my case this was:
Erase the folder sip-4.19.25 and extract it freshly from sip-4.19.25.tar.gz.
cd ~/documents/tmp/sip-4.19.25
~/.pyenv/versions/2.7.18/bin/python2.7 --sip-module=PyQt5.sip
make install

Now my test program does not give any error messages! Thanks again

More information about the PyQt mailing list