0

I'm trying to get PyQt5 working with WinPython. PyQt5 comes with a readme file for installation, and I have unsuccessfully tried a few combinations of what I thought the first part of the readme tells me to do.

I have:

  • Windows 7 Home Premium 64-bit
  • WinPython-64bit-2.7.9.1
  • Qt 5.4
  • PyQt-gpl-5.4

PyQt-gpl-5.4 is in the folder (only partially sure that this is where I should have put it)

C:\WinPython-64bit-2.7.9.1\python-2.7.9.amd64\Lib\site-packages\PyQt-gpl-5.4

My current attempt at getting everything working is: I'm trying to run the configure.py file in PyQt-gpl-5.4, but when I do so I consistently get the following error:

Error: PyQt5 requires Qt v5.0 or later. You seem to be using v4.8.6.
Make sure the correct version of qmake is on your PATH.

What I think is the required version of qmake being referred to is in the folder

C:\Qt\5.4\mingw491_32\bin

However, I have no idea how to fix the error by adding the qmake in this folder to PATH. My most recent attempt was to add the folder using Spyder's Tools->PYTHONPATH manager, but this made no difference. I also tried adding it using sys.path.append('C:\Qt\5.4\mingw491_32\bin'), but this didn't work either. I have since removed the folder name from both of these locations.

How do I get PyQt5 working with WinPython-64bit-2.7.9.1, or I think equivalently, how to I get the configure.py file in the PyQt-gpl-5.4 folder to run?

Thanks.

user3558855
  • 303
  • 4
  • 17

1 Answers1

0

You definitely don't want the source code (i.e. PyQt-gpl-5.4) in the site-packages folder, because that's where the compiled modules will end up. Instead, it should just go in a temporary folder whilst you compile it.

When you run configure.py, you must take care to use the executable for the specific python that you are targeting. I do not know anything about WinPython, but for a normal python installation this means doing something like this:

    C:\Python34\python configure.py

As a first step, before attempting to actually compile anything, it would be advisable to take at look at all the configuration options that are available, like this:

    C:\Python34\python configure.py --help

(There's also the Installing PyQt5 section in the PyQt Docs).

This will tell you, for instance, that the simplest way to specify the Qt installation you are targeting would be something like this:

    C:\Python34\python configure.py --qmake C:\Qt\5.4\mingw491_32\bin\qmake

EDIT:

Sorry, that last part is wrong: the --qmake option isn't available on Windows, so you have to add the directory containing the qmake executable to your PATH. This can be done with the following command:

    set PATH=%PATH%;C:\Qt\5.4\mingw491_32\bin
ekhumoro
  • 115,249
  • 20
  • 229
  • 336
  • Thanks for the response. When I read this, I tried it, but got the error: "no such option: --qmake". I looked in the configure.py file and found a line that says if sys.platform != 'win32': g.add_option("--qmake"...) So apparently my platform is win32, even though my OS is 64-bit. I don't know anything about platforms, but does this make sense? Should it be win64 instead of win32? If so, is there a way I can manually tell the computer to use win64 as the platform when doing this instead of win32? Thanks. – user3558855 Jan 24 '15 at 19:49
  • @user3558855. Sorry, I only looked at the help output in Linux, and missed the differences for Windows. I've updated my answer accordingly. – ekhumoro Jan 24 '15 at 20:06
  • Great, thanks very much. That got me passed the qmake issue. I'm still getting an error though, "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 use the verbose flag, " 'nmake' is not recognized as an internal or external command". I'm going to play around with it a bit more - the next thing I'm goint to try is to use Python 3 instead of 2 based on this link http://stackoverflow.com/questions/16846501/how-to-install-pyqt5-on-windows. – user3558855 Jan 24 '15 at 20:32