PyQt 4.5.4 for Python 2.5 amd64
PyQt 4.5.4 for Python 2.6 amd64
Recently I've written an interface for the first time with PyQt4 in Linux for one of our pipeline related scripts. It was working very well under Linux, until I decided to check how it is going to look under Windows x64.
Well, it didn't take too long for me to recognize that there is no PyQt4 for Python 2.5 amd64. So I decided to compile my own. By the way you will see that I started for Python 2.5 but compiled for Python 2.6, it is just because, in a panic mode I've installed Maya 2010 to see if the package I found for PyQt4 for Python 2.6 amd64 for Windows x64 will work under. But no it wasn't ( actually it was, but I didn't know that I should add the path that contains the Qt DLLs to environment path ). So I dived in to compiling PyQt4 for Python2.6 amd64 for Windows x64.
Here you can find the How-To of that compilation...
You need these packages and programs:
MS Visual Studio 2008
Python 2.6 amd64
Qt 4.5.2 SDK for Windows
Sip 4.8.2 Source
PyQt4 4.5.4 Source
Nullsoft scriptable install system
Lets start:
for Python 2.5, compiling PyQt4 for Python 2.5 x64 is quite similar, you just need to use vs2005 and its x64 command prompt compiler with the nearly the same commands, just replace win32-msvc2008's with win32-msvc2005, that's all...
EDIT 1:
for Python 2.6 version of PyQt4 you need to install Microsoft Visual C++ 2008 SP1 Redistributable Package (x64) also
for Python 2.5 version of PyQt4 Microsoft Visual C++ 2005 SP1 Redistributable Package (x64) also
EDIT 2:
I've compiled the Python 2.5 amd64 version of PyQt4 for Windows x64... Download (the Phonon Multimedia Framework is only supported by python 2.6 an later)
PyQt 4.5.4 for Python 2.6 amd64
Recently I've written an interface for the first time with PyQt4 in Linux for one of our pipeline related scripts. It was working very well under Linux, until I decided to check how it is going to look under Windows x64.
Well, it didn't take too long for me to recognize that there is no PyQt4 for Python 2.5 amd64. So I decided to compile my own. By the way you will see that I started for Python 2.5 but compiled for Python 2.6, it is just because, in a panic mode I've installed Maya 2010 to see if the package I found for PyQt4 for Python 2.6 amd64 for Windows x64 will work under. But no it wasn't ( actually it was, but I didn't know that I should add the path that contains the Qt DLLs to environment path ). So I dived in to compiling PyQt4 for Python2.6 amd64 for Windows x64.
Here you can find the How-To of that compilation...
You need these packages and programs:
MS Visual Studio 2008
Python 2.6 amd64
Qt 4.5.2 SDK for Windows
Sip 4.8.2 Source
PyQt4 4.5.4 Source
Nullsoft scriptable install system
Lets start:
- Install Python 2.6.2 amd64:
- install it to C:\Python2.6
- if you have already installed it somewhere else, in the rest of this "how-to" use that path instead of C:\Python26
- compile sip:
- download sip-4.8.2.zip
- unzip sip-4.8.2.zip to C:\sip-4.8.2
- open up the Visual Studio 2008 x64 Win64 Command Prompt from start menu/programs/etc.
- run the commands below
- cd C:\sip-4.8.2
- C:\Python26\python configure.py -p win32-msvc2008
- nmake
- nmake install
- open the python interpreter and check the module by using:
from sip import *
print SIP_VERSION_STR
if it doesn't give any error messages about a DLL or something, it is installed correctly - compile Qt4:
- download Qt SDK for Windows
- install it to C:\Qt\4.5.2 not to 2009.03
- delete the two tmp files: (they were causing problems in the middle of the compile process, very annoying to start again)
C:\Qt\4.5.2\qt\src\3rdparty\webkit\WebCore\tmp\moc\{debug,release}_shared/mocinclude.tmp) - open up the Visual Studio 2008 x64 Win64 Command Prompt
- run the commands below
- cd C:\Qt\4.5.2\qt
- set QTDIR=C:\Qt\4.5.2\qt
- set PATH=%PATH%;C:\Qt\4.5.2\bin
- configure -opensource -platform win32-msvc2008
- enter "y" for the question
- nmake ( and go to have a lunch or dinner, seriously, it took 3 hours in my computer, it will be around on yours too )
- nmake install
- congratulations you have built Qt4 x64 for Windows x64
(NOTE 1: you can create a batch file that runs the 'configure' then the 'nmake' and then the 'nmake install' commands, but when you run this batch file wait for 1 seconds to the question in configure step then leave :) )
(NOTE 2: because we didn't specified a -prefix option in configure, it will compile it over the source directories ) - compile PyQt4:
- download PyQt4 4.5.4 Source
- unzip the PyQt4 source to C:\PyQt-win-gpl-4.5.4
- open Visual Studio 2008 x64 Win64 Command Prompt
- run the commands below
- set QTDIR=C:\Qt\4.5.2\qt
- set Path=%PATH%;C:\Qt\4.5.2\qt\bin\
- cd C:\PyQt-win-gpl-4.5.4
- C:\Python26\python configure.py -w
- enter "yes" to the question
- nmake ( again it takes some time )
- nmake install
- now you should be able to use PyQt4, but if there is an error message saying:
Python 2.6.2 (r262:71605, Apr 14 2009, 22:5+:60) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or license" for more information.
>>> from PyQt4 import QtCore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found
>>>
you need to add the folder that contains Qt DLLs to the environment path variables, by using the Control Panel -> System -> Advanced -> Environment Variables - Nullsoft installer to make installable binary package:
- download and install Nullsoft installers latest version
- right click C:\PyQt-win-gpl-4.5.4\PyQt.nsi and select "Compile NSIS Script"
( unfortunatelly the script gives a lot of errors, you need to copy/paste some files and create folders by your self according to the complains of the compiler )
for Python 2.5, compiling PyQt4 for Python 2.5 x64 is quite similar, you just need to use vs2005 and its x64 command prompt compiler with the nearly the same commands, just replace win32-msvc2008's with win32-msvc2005, that's all...
EDIT 1:
for Python 2.6 version of PyQt4 you need to install Microsoft Visual C++ 2008 SP1 Redistributable Package (x64) also
for Python 2.5 version of PyQt4 Microsoft Visual C++ 2005 SP1 Redistributable Package (x64) also
EDIT 2:
I've compiled the Python 2.5 amd64 version of PyQt4 for Windows x64... Download (the Phonon Multimedia Framework is only supported by python 2.6 an later)
Comments
Cheers - ThreaderSlash
very useful , i was looking for the 64 bits version of pyQt for python 2.6.
by the way I used the visual express 2008 64 bits version (64bits compiler from windows SDK).
Worked great.
I am also a TD in a 3d STUDIO....
Cheers
Im just getting into Qt (With Maya)
C:\Python26\python configure.py -p win32-msvc2008
it wouldn't work because there is no configure.py file in the python26 folder. How do I get it?
for example:
cd C:\sip-4.8.2
To compile for python 2.5.2, do I use the following sources?
Python 2.5.2 amd64
PyQt 4.5.4-1 Source
Sip 4.8.2 Source
Qt 4.5.2 SDK for Windows
Also, where can you download these older sources and determine which one you need? I noticed both Riverbank and Nokia don't have a link to older builds. Or did I miss the link. :O.
Python 2.5.2 amd64
PyQt 4.5.4-1 Source
Sip 4.8.2 Source
Qt 4.5.2 SDK for Windows
Thanks for providing your experience with how to compile.
Thanks,
V
I tried to build against the lastest versions and get errors.
I heard there could be a conflict with not building with MinGW. The newest version of QT 4.6.0 provides an option to install MinGW and I'm wondering if that's why I'm getting errors.
Thanks,
F
I provided a link below to the errors I recieved. Thanks for taking a look!
V
Link to errors
delete the two tmp files: (they were causing problems in the middle of the compile process, very annoying to start again)
C:\Qt\4.5.2\qt\src\3rdparty\webkit\WebCore\tmp\moc\{debug,release}_shared/mocinclude.tmp)
I will run it again. Do you have to run the configure step again, or should I reinstall Qt and start from scratch?
Thanks,
V
I deleted the mocinclude.tmp file in both directories and got the exact same error.
I noticed during the nmake process, it spawend new mocinclude.tmp files in the same directories.
I did however find another location with the mocinclude.tmp file. Do think the compiler is sourcing from this directory as well?
C:\Qt\4.6.0\qt\src\script\tmp\moc\debug_shared
Thanks again for help!
I successfully compiled QT 4.6.0 against python 2.5.2.
When I ran the nmake install, I kept seeing "Cannot perform a cyclic copy" and Can overwrite over itself messages. Not sure if this is common or not.
Link error 2
just ignore the errors...
I tried to build PyQt and got some new errors.
Have you seen this error before?
PyQt errors
are you running the nmake from the standart command prompt or are you using the Visual Studio 2008 x64 Win64 Command Prompt ?
I'm at a loss with what it could be.
Below are all the sources I used.
Microsoft Visual 2005 x64 Command Prompt
Python 2.5.2 64 bit
PyQt-win-gpl-4.6.2 compiled with errors
sip-4.9.3 - compiled ok
Qt 4.6.0 - compiled ok
apparently you need to re-install your MSVC 2005
I will give that a try!
Thanks for your help!
V
Ok... I finally got it all compiled!
When I run the NSIS on PyQt.nsi
it stops with this error:
File: "C:\Python25\Lib\site-packages\PyQt4\sip.exe" -> no files found.
The sip.exe file is located in C:\sip-4.9.3\sipgen. Was this supposed to be installed in \Python25\Lib\site-packages\PyQt4\ or should I manually copy it?
Thanks,
V
Thanks again!
V
Does the PyQt.nsi remap all the paths when I create a binary installer package?
Thanks,
V
I got a quick question, when trying to do the c:\Python26\python configure.py -w (for the PyQt), i get the following error:
"C:\Python26\sip" -k -o -x VendorID -t WS_WIN -x PyQt_OpenSSL -x PyQt_NoPrintRangeBug -t Qt_4_4_1 -x Py_v3 -g -a QAxContainer.api -c QAxContainer -b QAxContainer\QAxContainer.sbf -I c:\PyQt-win-commercial-4.7\sip c:\PyQt-win-commercial-4.7/sip/QAxContainer/QAxContainermod.sip
sip: QVariantMap is undefined
Error: Unable to create the C++ code.
Help please :)
This gives me a CMD Shell that says its x64 however when I attempt to nmake sip I get errors.
First I run the configure.py which works, next I run nmake which fails:
LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
Any ideas?
Ryant, it should be about a missing flag, I don't remember the exact flag, but there was a flag telling the compiler about the target architecture, it should be that, on the other hand the cmd prompt from the express edition should already set these kind of things via environment variables, so I don't have a clear idea about your problem. Try googling the "LNK1112" error...
John, I mentioned that in my post, it is because your system couldn't find the Qt dll's, which are placed in the original qt directory ( C:\Qt\4.x.x\qt\bin\etc. just don't remember exactly). You should add the path that contains those dlls to the system path, or you should copy them to somewhere python searches already, like the c:\pythonx.x\lib\site-packages\PyQt4 folder
I hope it is not too late to answer your questions, and hope it will be helpful.
Next week, if I'm going to have time, I'll give it a try to compile the latest PyQt4 build for the latest Qt.