28

When I try installing the PyQt5 on Windows using the command

python configure.py

I get this error:

Error: Make sure you have a working Qt qmake on your PATH.

I got the pyQt5 from PyQt5 Download.

How can I install PyQt5?


Update:

I installed Qt 5.0.2 for Windows 64-bit (VS 2012, 500 MB) from the Qt Download page and now I have this error:

Querying qmake about your Qt installation...
Determining the details of your Qt installation...
Error: Failed to determine the detail of your Qt installation. Try again using
the --verbose flag to see more detail about the problem.

And when I execute the command python configure.py --verbose:

Querying qmake about your Qt installation...
Determining the details of your Qt installation...
C:\Qt\Qt5.0.2\5.0.2\msvc2012_64\bin\qmake.exe -spec win32-msvc2008 -o qtdetail.m
k qtdetail.pro
nmake -f qtdetail.mk release
'nmake' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
Error: Failed to determine the detail of your Qt installation. Try again using
the --verbose flag to see more detail about the problem.

I added C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin (contains nmake.exe) to PATH and I got this error:

Querying qmake about your Qt installation...
Determining the details of your Qt installation...
C:\Qt\Qt5.0.2\5.0.2\msvc2012_64\bin\qmake.exe -spec win32-msvc2008 -o qtdetail.mk qtdetail.pro
nmake -f qtdetail.mk release


Microsoft (R) Program Maintenance Utility Version 11.00.50727.1

Copyright (C) Microsoft Corporation.  All rights reserved.


  "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\nmake.exe" -f qtdetail.mk.Release


Microsoft (R) Program Maintenance Utility Version 11.00.50727.1

Copyright (C) Microsoft Corporation.  All rights reserved.

  cl -c -nologo -Zm200 -Zc:wchar_t -O2 -MD -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_CORE_LIB -I"..\..\..\..\..\..\..\Qt\Qt5.0.2\5.0.2\msvc2012_64\include" -I"..\..\..\..\..\..\..\Qt\Qt5.0.2\5.0.2\msvc2012_64\include\QtCore" -I"release" -I"..\..\..\..\..\..\..\Qt\Qt5.0.2\5.0.2\msvc2012_64\mkspecs\win32-msvc2008" -Forelease\ @C:\Users\Victor\AppData\Local\Temp\nm68EA.tmp

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.EXE"' : return code '0xc0000135'

Stop.

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\nmake.exe"' : return code '0x2'

Stop.
MarianD
  • 9,720
  • 8
  • 27
  • 44
Victor Lellis
  • 1,224
  • 1
  • 13
  • 22
  • 1
    Have you installed QT? pyQT should require QT. – brentlance May 30 '13 at 22:04
  • 1
    I installed QT and now I get another error: `'nmake' is not recognized as an internal command`. How to fix this? – Victor Lellis May 31 '13 at 03:16
  • 1
    I think that while you've added nmake.exe to your PATH, there are other environment variables that need to be set (for example your include and library paths). What worked for me was to run all of the commands from the Visual Studio Command Prompt. This will set all the necessary environment variables automatically. The VS Cmd Prompt should be installed with VS, and should be in your start menu. I successfully compiled and installed PyQT5, but when I run any of the examples I get errors like: from PyQt5.QtCore import QEventLoop, QTime SystemError: error return without exception set – actf Sep 26 '13 at 22:39
  • @actf pip3 install pyqt5 – tyasird Dec 28 '17 at 12:12

18 Answers18

33

Mainly I use the following command under the cmd

pip install pyqt5

And it works with no problem!

Malek B.
  • 1,019
  • 1
  • 11
  • 13
  • 1
    python 3.6 user here. I installed pyqt5 using pip without any issues. – user97662 Apr 16 '17 at 20:20
  • I'd also add the run your command prompt as administrator, you'll likely get some File Permission errors otherwise. – user3625087 Aug 24 '17 at 19:35
  • 2
    pip allows installing pyqt5 only for python3. Although not explicitly stated I would assume OP is using py2 and mostly only py2 users will land here. Consider this a suggestion to upgrade to py3 :) – NirIzr Dec 05 '17 at 02:10
  • 1
    I'm using Python3 and I landed here and I'm glad I read this answer before trying anything stupid... – Jérôme Jan 08 '18 at 08:00
  • Although on Windows this leads to "Successfully installed PyQt5-sip-4.19.12 pyqt5-5.11.2", a script of mine is still resulting in `ImportError: Matplotlib qt-based backends require an external PyQt4, PyQt5, PySide or PySide2 package to be installed, but it was not found.` – Ryan Aug 08 '18 at 03:31
  • worked perfectly for me, this is the best way to get it on Windows. Here's a link if you need to install pip first on Windows as I did: https://www.liquidweb.com/kb/install-pip-windows/ – Sam Feb 03 '21 at 12:07
13

The easiest way to install PyQt is to just use the installer (Link in your answer, step #5). If you install python 3.3, the installer will add all of the PyQt5 extras to that python installation automatically. You won't need to do any compiling (none of: nmake, nmake install, python configure).

All of the build options are available for if you need a custom install (for instance, using a different version of python, where there isn't an installer provided by riverbank computing).

If you do need to compile your own version of PyQt5, the steps (as you have found) are here, but assume you have python and a compiler installed and in your path. The installed and in your path have been where you have been running into trouble it seems. I'd recommend using the installer version, but you need to install python 3.3 first.

Brett Stottlemyer
  • 2,444
  • 3
  • 21
  • 36
  • 1
    The binary packages for Windows definitely seem to be the best bet. They mostly worked for me, however it seems none of the QtQuick, QML, or OpenGL examples work (even after installing PyOpenGL). All of the examples that load QML seem to just open an empty white window. – actf Sep 26 '13 at 22:31
  • 1
    @actf You probably have to download directx 9c end-user lib, as [explained recently on SO](http://stackoverflow.com/questions/23720122/pyqt5-and-qtquick/23816611#23816611). I was really dubious but it turns out that on Windows the OpenGL API (used by Quick) is implemented as a wrapper around DirectX! Installing that download fixed that issue (well a few pure OpenGL examples don't work, because they use PyOpenGL which I don't have working on my system). – Oliver May 31 '14 at 04:09
  • 1
    I keep reading about using the installer... what installer? is it just that versions pyqt5.9 doesn't have one? or am I blind? – Felipe Centeno Jul 20 '17 at 22:05
  • 1
    After downloading and installing I had to `pip3 install pyqt5`. Then could not install sip `requirement sip>=4.19.1 (from pyqt5)` – Hrvoje T Mar 05 '18 at 22:16
10

First try this in your Windows cmd window:

pip3 install pyqt5

If that is successful, it will look something like this:

C:\Windows\System32>pip3 install pyqt5
Collecting pyqt5
  Downloading PyQt5-5.9-5.9.1-cp35.cp36.cp37-none-win_amd64.whl (77.2MB)
    100% |################################| 77.2MB 13kB/s
Collecting sip<4.20,>=4.19.3 (from pyqt5)
  Downloading sip-4.19.3-cp35-none-win_amd64.whl (49kB)
    100% |################################| 51kB 984kB/s
Installing collected packages: sip, pyqt5
Successfully installed pyqt5-5.9 sip-4.19.3

If that did not work, you might try this link from SourceForge.

PyQt5 .exe installers for Windows

How to find the installer that's right for you?

First, determine what version of Python you have and whether you have 32-bit or 64-bit Python. Next, open one of the directories. I'm on Python 3.5 64-bit so I'm looking for a .exe with those specs. When you open a directory on SourceForge, you will see some directories with ONLY .zip or .tar.gz. That's not what you're looking for. A good indication of which directory you should click is given by the "Downloads/Week" column. I'll open the PyQt-5.6 directory in my case.

Here we notice some .exe files:

PyQt-5.6
|_PyQt5-5.6-gpl-Py3.5-Qt5.6.0-x32-2.exe
|_PyQt5-5.6-gpl-Py3.5-Qt5.6.0-x64-2.exe
|_PyQt5_gpl-5.6.zip
|_PyQt5_gpl-5.6.tar.gz

I know these are Python 3.5 by Py3.5 in the file name. I am also looking for the 64-bit version so I'll download PyQt5-5.6-gpl-Py3.5-Qt5.6.0-x64-2.exe. Final answer!

Note: if you try to install a version that's not compatible with your system, a dialog box will appear immediately after running the .exe. That's an indication that you've chosen the wrong one. I'm not trying to sound like a dbag... I did that several times!

To test a successful install, in your Python interpreter, try to import:

from PyQt5 import QtCore, QtGui, QtWidgets
Jarad
  • 12,183
  • 14
  • 71
  • 112
8

I found a partial solution...

Steps to install pyQt5 (with VS 2012) on Windows:

1) Install the binary file Qt 5.0.2 for Windows 64-bit (VS 2012, 500 MB) from here.

2) Get sip-4.14.7 (development snapshot) from here.

3) Extract the file and open the Developer Command Prompt for VS2012.

4) Execute these commands (in sip folder):

python configure.py
nmake
nmake install

5) Get the pyQt5 from here.

6) Extract the file and open the VS2012 x64 Native Tools Command Prompt.

7) Execute these commands:

python configure.py

UPDATE: When execute these commands below is not working:

nmake
nmake install

Solution: I will try use pyQt4 with Qt5... because pyQt5 is in development and doesn't have support/documentation yet.

Victor Lellis
  • 1,224
  • 1
  • 13
  • 22
  • 3
    get the Error: Make sure you have a working Qt qmake on your PATH. – rodling Dec 13 '13 at 23:18
  • 1
    Congrats - this was the first example of compiling c++ on WIndows I've got working. Rodling - find the bin directory in your QT directory, and add it to your system path. – Turtles Are Cute Jul 04 '14 at 15:32
4

One of the most (probably the most) easiest way to install site-packages like PyQt5 is installing one of the versions of Anaconda. You can just install many of site-packages by installing it. List of avaliable site-packages with Anaconda versions can be checked here.

  1. Dowload Anaconda3 or Anaconda2
  2. Install it.
  3. Add PyQt5's path inside Anaconda installation to your System Environment Variables.

For example:

PATH: ....; C:\Anaconda3\Lib\site-packages\PyQt5; ...
  1. It is ready to use.
cengineer
  • 1,052
  • 1
  • 10
  • 17
3

I'm new to both Python and PyQt5. I tried to use pip, but I was having problems with it using a Windows machine. If you have a version of Python 3.4 or above, pip is installed and ready to use like so:

python -m pip install pyqt5 

That's of course assuming that the path for Python executable is in your PATH environment variable. Otherwise include the full path to Python executable (you can type where python to the Command Window to find it) like:

C:\users\userName\AppData\Local\Programs\Python\Python34\python.exe -m pip install pyqt5
MarianD
  • 9,720
  • 8
  • 27
  • 44
Felipe Centeno
  • 1,355
  • 14
  • 29
3

If you're using Windows 10, if you use

    py -m pip install pyqt5

in the command prompt it should download fine. Depending on either the version of Python or Windows sometimes python -m pip install pyqt5 isn't accepted, so you have to use py instead. pip is a good way to download a lot of stuff, so I'd recommend that.

1

Another command under the cmd is:

easy_install pyqt5

Trigremm
  • 61
  • 6
  • easy_install is not a defined command of cmd.... Here is a link to the python module: http://setuptools.readthedocs.io/en/latest/easy_install.html – Felipe Centeno Jul 20 '17 at 22:02
1

If you have python installed completely, it can save you the hassle. All you need to do is enter the following command in your respective shell:

pip install pyqt5

And contrary to popular belief, AS LONG AS YOU HAVE PIP INSTALLED, you can do this on virtually any OS... Hope this helped!

NSO2008
  • 21
  • 3
1

It can be installed with below simple command:

pip3 install pyqt5
1

Download whl from here http://mirrors.aliyun.com/pypi/simple/pyqt5/

pip install PyQt5-5.15.4-cp36.cp37.cp38.cp39-none-win_amd64.whl

If error comes try this

pip install --user PyQt5-5.15.4-cp36.cp37.cp38.cp39-none-win_amd64.whl

Done

0

If you are using canopy, use the package manager to install qt (and or pyqt)

Ivan_ug
  • 1,889
  • 2
  • 12
  • 10
0

You can easily install it using Anaconda. At first install Anaconda or Miniconda on you system (download from here) and then install the pyqt as follow:

conda install pyqt

It works for both version of python (2 and 3).

Ali Mirzaei
  • 1,208
  • 1
  • 12
  • 22
0

To install the GPL version of PyQt5, run (see PyQt5 Project):

pip3 install pyqt5

This will install the Python wheel for your platform and your version of Python (assuming both are supported).

(The wheel will be automatically downloaded from the Python Package Index.)

The PyQt5 wheel includes the necessary parts of the LGPL version of Qt. There is no need to install Qt yourself.

(The required sip is packaged as a separate wheel and will be downloaded and installed automatically.)


Note:

If you get an error message saying something as

No downloads could be found that satisfy the requirement 

then you are probably using an unsupported version of Python.

MarianD
  • 9,720
  • 8
  • 27
  • 44
0

If you are facing problem with pip3 install pyqt5 then try pip3 install pyqt5==5.12.0
This solved the problem for me

theshubhagrwl
  • 415
  • 5
  • 8
0

easiest way, I think download Eric, unzip go to sources, open python directory, drag the install script into the python icon, not folder, follow prompts

0
C:\Users\Digiline>python3 -m pip install pyqt5                                                                                                                          

Collecting pyqt5                                                                                                                                                          Downloading PyQt5-5.15.4-cp36.cp37.cp38.cp39-none-win_amd64.whl (6.8 MB)                                                                                                   |████████████████████████████████| 6.8 MB 3.3 MB/s                                                                                                                 Collecting PyQt5-sip<13,>=12.8                                                                                                                                            Downloading PyQt5_sip-12.8.1-cp39-cp39-win_amd64.whl (63 kB)                                                                                                               |████████████████████████████████| 63 kB 71 kB/s                                                                                                                   Collecting PyQt5-Qt5>=5.15                                                                                                                                                Downloading PyQt5_Qt5-5.15.2-py3-none-win_amd64.whl (50.1 MB)                                                                                                              |████████████████████████████████| 50.1 MB 16 kB/s                                                                                                                 Installing collected packages: PyQt5-sip, PyQt5-Qt5, pyqt5 
                                                                                                               
WARNING: The scripts pylupdate5.exe, pyrcc5.exe and pyuic5.exe are installed in 'C:\Users\Digiline\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts' which is not on PATH.                                                                                                   Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.                                                     Successfully installed PyQt5-Qt5-5.15.2 PyQt5-sip-12.8.1 pyqt5-5.15.4

                                                                                                                                                                                       
Suraj Rao
  • 28,186
  • 10
  • 88
  • 94
ranojan
  • 647
  • 6
  • 9
0

I was having issue due to spyder and the versions were colliding so I tried this

pip uninstall pyqt5

pip uninstall spyder

pip install spyder 

This installed all!

Rohit gupta
  • 198
  • 12