Building and Installing PyQt
Obtaining and installing everything needed for PyQt can be quite a task! Moreover, Maya 2012 requires some different steps to make sure you have all of the proper files needed to get going with PyQt. The information provided here should help you locate everything you need to download to be ready to build and install PyQt on your particular operating system, whether it is Windows, OS X, or Linux.
Overview and Download Links
If you have previously built the PyQt libraries for Maya 2011 and older, Autodesk has made some changes in the delivery of Qt in Maya 2012 and newer. There is now an Autodesk-customized version of the open source Qt framework, which is required for C++ or PyQt GUIs. Consequently, you do not need the complete Qt SDK for Maya 2012 and newer (because they use the Autodesk-modified version), but you can download the source packages of the Qt framework if you need access Qt Designer or anything else that comes with the framework.
Note that 32-bit and 64-bit versions of Qt cannot coexist in the same directory tree. If you want both versions installed on the same system then you will have to configure, build, and install Qt twice, using different installation directories each time.
The items you are going to need to download to prepare for building and installing PyQt are:
- An appropriate version of the Qt SDK for Maya 2011 and older, or Autodesk’s modified Qt source for Maya 2012 (under the heading QT4.7.1 modified for Maya)
- SIP, a C++ wrapper tool
- PyQt* (for Windows, use Python version 2.6, which is the version used in Maya 2012)
- Microsoft Visual Studio 2008, SP 1 (Windows only)**
*PyQt does not have the same licensing as Autodesk Maya, Qt, or Python. Please consult the PyQt website for information about licensing.
**These instructions should also work with Microsoft Visual Studio Express.
You do not need a specific version of SIP and PyQt—any recent version is good. PyQt keeps up with Qt, so anything after the compatible Qt version that is documented in the Maya API documentation is suitable. Once you have built and installed the first three components, you end up with PyQt binaries, which you put in your site-packages directory. Thereafter, you will be ready to start building custom PyQt GUIs!
Building and Installing PyQt
I am prefacing these build instructions by noting that I found I had to tinker with the settings and file locations to make it build. I have added in where I had to make adjustments, but everyone’s computer and environment is different, so what worked for me may not work for you. In spite of these few modifications, I successfully built and installed PyQt with Maya 2012, allowing me to create my PyQt custom GUIs for Maya 2012.
Jump to:
Windows
Building Qt
- Unzip the Qt package you downloaded from the Autodesk website,
Qt-4.7.1-Modified_for_Maya.zip
to a folder (e.g.,C:\qt-adsk-4.7.1
). - Follow the instructions inside the zip file (howToBuildQtOnWindows_m2012.txt) to configure and build the modified Maya Qt SDK.
Building SIP
- Unzip the SIP package you downloaded from the Riverbank Computing website,
sip-4.12.4.zip
, to a folder (e.g.,C:\sip-4.12.4
). - Start a Microsoft Visual Studio 2008 Command Prompt (Start -> All Programs -> Microsoft Visual Studio -> Visual Studio Tools -> Visual Studio 2008 Command Prompt).
- Change to the directory into which you extracted SIP.
cd c:\sip-4.12.4
- Execute the following commands in the Command Prompt. The first line is required so the build can find python26.lib.
set LIB=%LIB%;C:\Program Files\Autodesk\Maya2012\lib
"C:\Program Files\Autodesk\Maya2012\bin\mayapy" configure.py
nmake
nmake install
SIP will now be installed in Maya’s site‐packages directory located at C:\Program Files\Autodesk\Maya2012\Python\lib\site-packages
.
Building PyQt
- Unzip the PyQt package you downloaded from the Riverbank Computing website,
PyQt-win-gpl-4.8.5.zip
, to a folder (e.g.,C:\PyQt-win-gpl-4.8.5
). - Start a Microsoft Visual Studio 2008 Command Prompt.
- Change to the directory into which you extracted PyQt.
cd c:\PyQt-win-gpl-4.8.5
- Execute the following commands in the Command Prompt. The PyQt configure.py script searches the PATH for a Qt installation. If you have other Qt installations, make sure they aren’t in the PATH.
set QTDIR= c:\qt-adsk-4.7.1
set PATH=c:\qt-adsk-4.7.1\bin;%PATH%
set QMAKESPEC=C:\qt-adsk-4.7.1\mkspecs\win32‐msvc2008
"C:\Program Files\Autodesk\Maya2012\bin\mayapy" configure.py ‐w LIBDIR_QT=C:\qt-adsk-4.7.1\lib INCDIR_QT=C:\qt-adsk-4.7.1\include
- You might get errors here so it is helpful to pipe it out to a file so you can see all the output.
"C:\Program Files\Autodesk\Maya2012\bin\mayapy" configure.py -w LIBDIR_QT=C:\qt-adsk-4.7.1\lib INCDIR_QT=C:\qt-adsk-4.7.1\include > config.txt
set INCLUDE=%INCLUDE%;C:\Program Files\Autodesk\Maya2012\include\python2.6;C:\qt-adsk-4.7.1\include
nmake
nmake install
If these commands result in errors referring to D:\qt
, first search and replace all occurrences of D:\qt-adsk-4.7.1
to C:\qt-adsk-4.7.1
in all makefiles in the PyQt folder.
PyQt4 will now be installed in Maya’s site‐packages directory located at C:\Program Files\Autodesk\Maya2012\Python\lib\site-packages
.
OS X
Building Qt
- Unzip the package you downloaded from the Autodesk website,
Qt-4.7.1-Modified_for_Maya.zip
. - Follow the instructions inside the zip file (howToBuildQtOnMac_m2012.txt), to configure and build the modified Maya Qt SDK.
Building SIP
- Open the Terminal application (Applications -> Utilities -> Terminal).
- Change to the directory into which you saved the SIP download, such as e.g.,
cd ~/Downloads
- Execute the following lines to build SIP.
tar ‐zxvf sip‐4.12.4.tar.gz
cd sip‐4.12.4
/Applications/Autodesk/maya2012/Maya.app/Contents/bin/mayapy configure.py ‐‐arch=x86_64
make
sudo make install
SIP will now be installed in Maya’s site‐packages directory located at /Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site‐packages
.
Building PyQt
- Open the Terminal application.
- Change to the directory into which you saved the PyQt download, such as e.g.
cd ~/Downloads
- Execute the following lines to build PyQt.
tar ‐zxvf PyQt‐mac‐gpl‐4.8.5.tar.gz
cd PyQt‐mac‐gpl‐4.8.5
export QTDIR=/usr/local/Trolltech/Qt‐4.8.5
export PATH=/usr/local/Trolltech/Qt‐4.8.5/bin:$PATH
export QMAKESPEC=/usr/local/Trolltech/Qt‐4.8.5/mkspecs/macx‐g++
export DYLD_LIBRARY_PATH=/usr/local/Trolltech/Qt‐4.8.5/lib
/Applications/Autodesk/maya2012/Maya.app/Contents/bin/mayapy configure.py
LIBDIR_QT=/usr/local/Trolltech/Qt‐4.8.5/lib INCDIR_QT=/usr/local/Trolltech/Qt‐4.8.5/include
MOC=/usr/local/Trolltech/Qt‐4.8.5/bin/moc ‐w ‐‐no‐designer‐plugin
make ‐j8
sudo make install
- PyQt will now be installed in Maya’s site‐packages directory located at
/Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site‐packages/PyQt4
. At this point PyQt is installed, but the binaries are improperly linked for Maya, which must be corrected. Maya only includes the Qt binaries that it actually uses, so there are several installed PyQt modules which will not work because they won’t find the missing libraries. This problem can in theory be solved by copying in the missing libraries from the Qt build earlier. Execute the following lines in Terminal to do so.
sudo find /Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site‐packages/PyQt4 ‐name "*so" ‐exec install_name_tool ‐change libQtCore.4.dylib @executable_path/QtCore {} \;
sudo find /Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site‐packages/PyQt4 ‐name "*so" ‐exec install_name_tool ‐change libQtGui.4.dylib @executable_path/QtGui {} \;
sudo find /Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site‐packages/PyQt4 ‐name "*so" ‐exec install_name_tool ‐change libQtSvg.4.dylib @executable_path/QtSvg {} \;
sudo find /Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site‐packages/PyQt4 ‐name "*so" ‐exec install_name_tool ‐change libQtOpenGL.4.dylib @executable_path/QtOpenGL {} \;
sudo find /Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site‐packages/PyQt4 ‐name "*so" ‐exec install_name_tool ‐change libQtXml.4.dylib @executable_path/QtXml {} \;
Linux
Building Qt
- Unzip the package you downloaded from the Autodesk website,
Qt-4.7.1-Modified_for_Maya.zip
. - Follow the instructions inside the zip file (howToBuildQtOnLinux_m2012.txt) in order to configure and build the modified Maya Qt SDK. In the instructions file, you can skip downloading the Qt SDK from the Nokia website, as we downloaded a custom version from the Autodesk website. There is also one incorrect item in this file. It says the default gcc version is 4.10 for Maya 2012, which is not the case. The default gcc version is 4.1.2 for Maya 2012.
Building SIP
- Open the Terminal application.
- Unzip the package you downloaded from the Riverbank Software website,
sip-4.12.4.tar.gz
. - Execute the following commands in a command prompt:
cd sip‐4.12.4
/usr/autodesk/maya2012‐x64/bin/mayapy configure.py
make
sudo make install
SIP will now be installed in Maya’s site‐packages directory located at /usr/autodesk/maya2012‐x64/lib/python2.6/site‐packages/
.
Building PyQt
- Unzip the package you downloaded from the Riverbank Software website,
PyQt-x11-gpl-4.8.5.tar.gz
. - Execute the following commands in a command prompt:
cd PyQt‐x11‐gpl‐4.8.5
/usr/autodesk/maya2012‐x64/bin/mayapy configure.py ‐q /usr/local/Trolltech/Qt4.8.5/bin/qmake
make ‐j4
sudo make install
PyQt will now be installed in Maya’s site‐packages directory located at /usr/autodesk/maya2012‐x64/lib/python2.6/sitepackages/PyQt4
.
found this link with a compiled PyQt for Windows 64bit and 32bit.
http://nathanhorne.com/?p=322
charlie cullpepper said this on December 30, 2011 at 5:21 pm |
It’s going to be ending of mine day, however before finish I am reading this great post to improve my knowledge.
Alejandrina said this on March 16, 2015 at 12:36 pm |
you are truly a excellent webmaster. The website loading
velocity is amazing. It kind of feels that you’re doing any distinctive trick.
Furthermore, The contents are masterpiece. you’ve done a magnificent process on this topic!
comment devenir riche en partant de rien said this on March 18, 2015 at 3:51 pm |
są zdecydowane oddać suma hec matrymonialnych, pospołu spośród krępującymi, jeśli
przewidują że awansowanie się na nie
da im zdeterminowaną przewagę. Są srodze sprytne plus jeśliby oczywiście bieżące mogę sformułować
– surowe. W 4 fuksach na 5 poufale zaciekawione prowadzeniem
stwierdzaj do zbitego funduszu.
ąąłćżę said this on March 19, 2015 at 9:20 am |
Amazing issues here. I’m very glad to look your article.
Thank you so much and I’m looking ahead to toucch you. Will
you please droip me a e-mail?
rencontre en ligne film said this on March 21, 2015 at 12:34 pm |
After checking out a few of the blog articles on your web site, I seriously appreciate your way of blogging.
I bookmarked it to my bookmark webpage list and will be checking back in the near future.
Please check out my web site tooo and tell me your opinion.
Www.devenirrichesurinternet.com said this on March 23, 2015 at 2:26 pm |
Wow, superb weblog format! How lengthy have you been blogging for?
you make running a blog glance easy. The whole glance of youur web site is wonderful,
let alone thhe content!
devenir riche said this on March 23, 2015 at 2:32 pm |
Hi! I could have sworn I’ve been to this site before but after checking through
some of the post I realized it’s new to me. Anyways, I’m definitely happy I
found it and I’ll be book-marking and checking back frequently!
เอมมูร่า said this on December 16, 2015 at 9:34 pm |
Thanks for some other fantastic post. The place else could
anybodyy get that type of information in shch a perfect means oof writing?
I’ve a presentation next week, and I’m on the look for such info.
draguer une fille said this on December 28, 2015 at 6:43 am |
http://programmer-veer.blogspot.in/2016/09/how-to-install-pyqt-for-maya-2013.html
veer said this on September 21, 2016 at 4:33 am |
Everything is very open with a really clear explanation of
the challenges. It was truly informative. Your website is
useful. Thank youu for sharing!
best lesbian said this on November 6, 2018 at 11:20 am |
I see you don’t monetize maya-python.com, don’t waste your
traffic, you can earn additional cash every month. There is one good way that brings decent money, you can google it: money making
by bucksflooder
BestSilas said this on April 1, 2019 at 2:41 pm |