Install old version PyQt4 on a mac by compiling the source

Felix Voigt info at felibunda.eu
Tue Jul 13 21:39:40 BST 2021



> On 10. Jul 2021, at 12:29, Phil Thompson <phil at riverbankcomputing.com> wrote:
> 
> On 10/07/2021 11:16, Felix Voigt wrote:
>>> 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?
> 
> https://www.riverbankcomputing.com/static/Docs/PyQt5/installation.html#building-the-sip-module
> 
> Phil

Hello again,
thanks for the answer.
If I take the PyQt5_sip-12.9.0.tar.gz version downloaded from https://pypi.org/project/PyQt5-sip/#files, I obtain the following:
After the commands
cd ~/documents/tmp/PyQt5_sip-12.9.0
~/.pyenv/versions/2.7.18/bin/python2.7 setup.py  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

feli_x




More information about the PyQt mailing list