Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Install PyQt5 to Mac OS X Yosemite with python3
This snippet tested on Yosemite 10.10.1
1. Define your python3 directory (for example, "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/")
2. Download "http://download.qt-project.org/official_releases/qt/5.3/5.3.2/qt-opensource-mac-x64-clang-5.3.2.dmg" or any other new version of qt for mac and install it.
3. Download SIP sources here: http://www.riverbankcomputing.com/software/sip/download
4. Download PyQt5-gpl sources here: http://www.riverbankcomputing.com/software/pyqt/download5
5. Go to your downloads by terminal (for example, "cd ~/Downloads")
6. tar xvf PyQt-gpl-5.3.2.tar.gz
7. tar xvf sip-4.16.4.tar.gz
8. cd sip-4.16.4/
9. python3 configure.py -d /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3//site-packages --arch x86_64
10. make
11. sudo make install
12. sudo make clean
13. Change line "!host_build:QMAKE_MAC_SDK = macosx10.8" to "!host_build:QMAKE_MAC_SDK = macosx10.10" in ~/Qt5.3.2/5.3/clang_64/mkspecs/qdevice.pri
14. cd ../PyQt-gpl-5.3.2/
15. python3 configure.py --destdir /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages --qmake ~/Qt5.3.2/5.3.2/clang_64/bin/qmake
16. make
17. sudo make install
18. sudo make clean
@s200999900

This comment has been minimized.

Show comment Hide comment
@s200999900

s200999900 Mar 7, 2015

Thanks!

Thanks!

@SimFre

This comment has been minimized.

Show comment Hide comment
@SimFre

SimFre Mar 15, 2015

Thanks for the guide! Python/PyQt is eating on my nerves by now and your guide has taken me a step further. I keep getting this when trying to setup PyQt:
"Error: Make sure you have a working sip on your PATH or use the --sip argument".
Command line: python3 configure.py --qmake ~/Qt/5.4/clang_64/bin/qmake --destdir /usr/local//Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
The path is the same as given in the previous step. Any idea on how to work this out?

Edit:
Found the proper path when running make install for sip.
This worked: python3 configure.py --sip=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/bin/sip

SimFre commented Mar 15, 2015

Thanks for the guide! Python/PyQt is eating on my nerves by now and your guide has taken me a step further. I keep getting this when trying to setup PyQt:
"Error: Make sure you have a working sip on your PATH or use the --sip argument".
Command line: python3 configure.py --qmake ~/Qt/5.4/clang_64/bin/qmake --destdir /usr/local//Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
The path is the same as given in the previous step. Any idea on how to work this out?

Edit:
Found the proper path when running make install for sip.
This worked: python3 configure.py --sip=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/bin/sip

@bigeyex

This comment has been minimized.

Show comment Hide comment
@bigeyex

bigeyex Dec 14, 2015

thanks very much!
there is one place that may need update. (Due to Qt version number change)

if anybody encounters error:
configure.py: error: '/Users/xxx/Qt5.3.2/5.3.2/clang_64/bin/qmake' is not an executable

S/he should change it to
configure.py: error: '/Users/wangyu/Qt5.3.2/5.3/clang_64/bin/qmake' is not an executable

or any path qmake actually lives.

bigeyex commented Dec 14, 2015

thanks very much!
there is one place that may need update. (Due to Qt version number change)

if anybody encounters error:
configure.py: error: '/Users/xxx/Qt5.3.2/5.3.2/clang_64/bin/qmake' is not an executable

S/he should change it to
configure.py: error: '/Users/wangyu/Qt5.3.2/5.3/clang_64/bin/qmake' is not an executable

or any path qmake actually lives.

@frozenyeti789

This comment has been minimized.

Show comment Hide comment
@frozenyeti789

frozenyeti789 Feb 22, 2016

ahhh crap! I somehow managed to download SIP files (through the different way). But i can't install PyQt5 files..? why, what is my problem?

ahhh crap! I somehow managed to download SIP files (through the different way). But i can't install PyQt5 files..? why, what is my problem?

@ClayLewis

This comment has been minimized.

Show comment Hide comment
@ClayLewis

ClayLewis Feb 24, 2016

What error's are you getting, frozenyeti?

What error's are you getting, frozenyeti?

@wxyBUPT

This comment has been minimized.

Show comment Hide comment
@wxyBUPT

wxyBUPT Mar 2, 2016

thanks very much!

but I can't understand the first step " 1. Define your python3 directory ",

what should I do for the first step?

wxyBUPT commented Mar 2, 2016

thanks very much!

but I can't understand the first step " 1. Define your python3 directory ",

what should I do for the first step?

@vityafx

This comment has been minimized.

Show comment Hide comment
@vityafx

vityafx Apr 4, 2016

@wxyBUPT you need just to find out where is site-packages directory of your python3 installation. If you have few, you must remember it somehow and use in the steps below, for example, create an environment variable $SP_PYTHON_DIR=...(your dir). It is only needed for next steps (15 step).

Owner

vityafx commented Apr 4, 2016

@wxyBUPT you need just to find out where is site-packages directory of your python3 installation. If you have few, you must remember it somehow and use in the steps below, for example, create an environment variable $SP_PYTHON_DIR=...(your dir). It is only needed for next steps (15 step).

@jonsavage

This comment has been minimized.

Show comment Hide comment
@jonsavage

jonsavage May 7, 2016

Thanks for the guide.

If installing on 10.10.4 make sure to change macosx10.8 to macosx10.10.11 on step 13

Thanks for the guide.

If installing on 10.10.4 make sure to change macosx10.8 to macosx10.10.11 on step 13

@SB2502

This comment has been minimized.

Show comment Hide comment
@SB2502

SB2502 Jan 25, 2017

Ok, this worked for my macOS 10.12.2 / Qt 5.80 / PyQt5.7.1 / sip 4.19 / Python3.5 installation up until step 13.

The file ~/Qt5.3.2/5.3/clang_64/mkspecs/qdevice.pri however did not contain any !host reference and simply adding it myself did not help.

Then I found this post on Stack Overflow. It stated I should run:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

which worked like a charm all the way up to step 15.

During step 15 however, I received the error:

This is the GPL version of PyQt 5.7.1 (licensed under the GNU General Public
License) for Python 3.5.3 on darwin. Error: This version of PyQt5 and the commercial version of Qt have incompatible licenses.

I was able to fix that error by commenting out some lines in PyQt5 configure.py as instructed here.

Then, I continued and the command from step 15 executed without a problem.

However, now, when I run make (step 16) I am receiving this error:

~/Downloads/PyQt5_gpl-5.7.1/QtCore/sipQtCoreQt.cpp:1093:62: error: no member named 'WindowCancelButtonHint' in namespace 'Qt'; did you mean
'WindowCloseButtonHint'?
{sipName_WindowCancelButtonHint, static_cast( ::Qt::WindowCancelButtonHint), 419},
^
WindowCloseButtonHint
../../../Qt5.8.0/5.8/clang_64/lib/QtCore.framework/Headers/qnamespace.h:300:9: note: 'WindowCloseButtonHint' declared here
WindowCloseButtonHint = 0x08000000,
^
~/Downloads/PyQt5_gpl-5.7.1/QtCore/sipQtCoreQt.cpp:1106:58: error: no member named 'WindowOkButtonHint' in namespace 'Qt'
{sipName_WindowOkButtonHint, static_cast( ::Qt::WindowOkButtonHint), 419},
~~~~~~^
2 errors generated.
make[1]: *** [sipQtCoreQt.o] Error 1
make: *** [sub-QtCore-make_first-ordered] Error 2

Does anyone have any idea how to fix this?

SB2502 commented Jan 25, 2017

Ok, this worked for my macOS 10.12.2 / Qt 5.80 / PyQt5.7.1 / sip 4.19 / Python3.5 installation up until step 13.

The file ~/Qt5.3.2/5.3/clang_64/mkspecs/qdevice.pri however did not contain any !host reference and simply adding it myself did not help.

Then I found this post on Stack Overflow. It stated I should run:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

which worked like a charm all the way up to step 15.

During step 15 however, I received the error:

This is the GPL version of PyQt 5.7.1 (licensed under the GNU General Public
License) for Python 3.5.3 on darwin. Error: This version of PyQt5 and the commercial version of Qt have incompatible licenses.

I was able to fix that error by commenting out some lines in PyQt5 configure.py as instructed here.

Then, I continued and the command from step 15 executed without a problem.

However, now, when I run make (step 16) I am receiving this error:

~/Downloads/PyQt5_gpl-5.7.1/QtCore/sipQtCoreQt.cpp:1093:62: error: no member named 'WindowCancelButtonHint' in namespace 'Qt'; did you mean
'WindowCloseButtonHint'?
{sipName_WindowCancelButtonHint, static_cast( ::Qt::WindowCancelButtonHint), 419},
^
WindowCloseButtonHint
../../../Qt5.8.0/5.8/clang_64/lib/QtCore.framework/Headers/qnamespace.h:300:9: note: 'WindowCloseButtonHint' declared here
WindowCloseButtonHint = 0x08000000,
^
~/Downloads/PyQt5_gpl-5.7.1/QtCore/sipQtCoreQt.cpp:1106:58: error: no member named 'WindowOkButtonHint' in namespace 'Qt'
{sipName_WindowOkButtonHint, static_cast( ::Qt::WindowOkButtonHint), 419},
~~~~~~^
2 errors generated.
make[1]: *** [sipQtCoreQt.o] Error 1
make: *** [sub-QtCore-make_first-ordered] Error 2

Does anyone have any idea how to fix this?

@kmcintyre

This comment has been minimized.

Show comment Hide comment
@kmcintyre

kmcintyre Jan 29, 2017

Edited the sipQtCoreQt.cpp and removed the 2 offending lines.

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

This worked fine on ubuntu.

This patch gave me the confidence that I wasn't totally messing up my computer.

Edited the sipQtCoreQt.cpp and removed the 2 offending lines.

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

This worked fine on ubuntu.

This patch gave me the confidence that I wasn't totally messing up my computer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment