Install old version PyQt4 on a mac by compiling the source

Felix Voigt info at felibunda.eu
Sun Aug 1 21:42:29 BST 2021



> On 14. Jul 2021, at 07:39, Felix Voigt <info at felibunda.eu> wrote:
> 
> 
> 
>> On 13. Jul 2021, at 23:01, Phil Thompson <phil at riverbankcomputing.com> wrote:
>> 
>> On 13/07/2021 21:39, Felix Voigt wrote:
>>>> 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
>> 
>> My apologies (Python v2 is no longer supported), you probably need to use SIP v4 (also no longer supported) which you can find here...
>> 
>> https://www.riverbankcomputing.com/software/sip/download
>> 
>> Phil
> 
> Dear Phil,
> 
> thanks. I already had compile sip4.19.25, but PyQt5.15.4 did not find the module.
> On the site http://python.6.x6.nabble.com/private-sip-td5235854.html 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 configure.py --sip-module=PyQt5.sip
> make
> make install
> 
> Now my test program does not give any error messages! Thanks again
> feli_x
> 
> 

Hello again,

today I tried to compile PyQt4 for another python program.
I downloaded PyQt4_gpl_mac-4.12.3.tar.gz from https://riverbankcomputing.com/software/pyqt/download and unpacked it into ~/documents/tmp.
cd ~/documents/tmp/PyQt4_gpl_mac-4.12.3
~/.pyenv/versions/2.7.18/bin/python2.7 configure.py --qmake /usr/local/Cellar/qt at 4/4.8.7_6/bin/qmake --sip=/Users/felixvoigt/.pyenv/versions/2.7.18/bin/sip —verbose

This effected the following output:
Determining the layout of your Qt installation...
/usr/local/Cellar/qt at 4/4.8.7_6/bin/qmake -spec macx-g++ -o qtdirs.mk qtdirs.pro
make -f qtdirs.mk
g++ -c -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/usr/local/etc/qt4/mkspecs/macx-g++ -I. -I/usr/local/include/QtCore -I/usr/local/include -I. -F/usr/local/lib -o qtdirs.o qtdirs.cpp
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
qtdirs.cpp:1:10: fatal error: 'QCoreApplication' file not found
#include <QCoreApplication>
         ^~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
make: *** [qtdirs.o] Error 1
Error: Failed to determine the layout of your Qt installation. Try again using
the --verbose flag to see more detail about the problem.

I have the impression that some paths are not set correctly. E.g. the right path to QtCore is
/usr/local/Cellar/qt at 4/4.8.7_6/include/QtCore
But I do not know, how to set the path for the configure process.

Does somebody have a clue?

Regards
feli_x




More information about the PyQt mailing list