русский | english
In this article I am going to describe the methods of installation PyQt in your computer. The ways of the installation of the operating system are examined for writing separate independent applications for Maya and Nuke which have an interface that built on Qt. And also for Houdini that not supports Qt but has fairly acceptable facilities for a modification.
How to install PyQt on Windows
First make sure to install Python at your OS. You have to do it if Python wasn't installed. For it you can download Python from the official website. Also you need to download installation exe file from the official website, too and launch the installation process. Further just wait for a some minutes till the process is finished. It's done automatically. Be sure to download a version for your Python interpreter. And don't forget to check the paths of installation.
How to install PyQt on Linux
Run command in a terminal:
The installation will run automatically. It was tested by me only on Ubuntu. Other distributions may have some differences. The methods shown above are the simplest. If something is wrong, you can find enough information about the installation for in different cases in the Internet.
Installation PyQt for Maya
To PyQt worked in Maya requires a special distribution that is compiled independently and based on the source from the site of Autodesk for a particular platform and version of Maya. Example assembly instructions may be seen here and here. Also may download pre-comliled packages and just install them.
I am gonna help you and below I'm giving the links to the packages I use by myself. I don't have installers for other versions and platforms.
On Windows
The installation can look like this:
The first way involves the installation by running exe file. In this case you should make sure the folder is the oe of the Maya's interpreter , not a system interpreter of Python. For example, it can have the following address:
And after the installation is completed, don't forget to check that the folder placed here:
On Linux
Usually it looks like an archive with ready files. You need to copy them manually. For example, address would be:
Installation PyQt for Nuke
Here all are the same. Either use the installation exe file, or an archive that needs to be extracted to the proper place.
For Windows it may be here:
For Linux::
Installation PyQt for Houdini
Qt is not used in Houdini as a graphical interface engine (an engine for the construction of the interface) (as it is done in Maya and Nuke) therefore it is suitable to distro from official site. You have to install it in directory of Houdini's interpreter.
The installation path may look like this, for example:
Windows
Linux
After that you need to find a file called pyqt_thread_helper.py , that's located in the documentation files.
and copy it to the directory of Python's packages, where PyQt had already been installed .
This file is necessary to launch Qt's windows apart form the daughterly process from Houdini. Here you should notice that the version of PyQt must be for Python 2.6 because this version is used in Houdini ( at the moment writting this article).
How to check successful installation
Below I am gonna write the instructions that will help you to check if the installation PyQt had been successful.
Now I'm going to describe how to check successful pyqt installation on operating systems and applications.
Checking installation for Windows and Linux
You need to save it as a file with the extension .py and run it with the interpreter, on which PyQt was installed. If a window was opened it must mean PyQt was installed successfully. Otherwise it depends on the resulting errors.
Checking installation for Maya
The following code to copy in ScriptEditor and run
If the window was opened at least it might mean PyQt was installed in a proper directory. If you see the errors about loading PyQt's module, it could mean the installation has been done incorrectly. If errors show that something is not supported or there is a wrong classes of C++ it probably means the packet which has been installed does not fit to the current version of Maya. For example it is from another version or the original package is installed.
If PyQt has been installed correctly in a proper directory python-shell packages of Maya's Interpreter but the system variable PYTHONPATH or the order of the links is such that the link to the original package comes before, system's PyQt will be loaded. In this case you need to fix the PYTHONPATH or use the wrapper to run Maya.
Checking installation for Houdini
Open a window Windows\Python Source Editor and copy this code:
Checking installation for Nuke
This code to copy in ScriptEditor and run
Conclusion
The proposed methods do not tend to be absolutely right and authentic. Because you can't be sure in advance, how problems will not be. But you have a Google and you may find a decision on the forums, you may ask in the comments.
Links
Maya2011 Windows_x64
Maya2012 Windows_x64
4.7.1 for Maya2013 Windows_x64
4.9.1 for Maya2013 Windows x64
In Maya 1014 and above, use the built module PySide
Maya 2012 Lunux x64
Nuke6.3 Windows
Nuke6.3 Linux x64
If you have OSX you can check Justin Israel's Installing PyQt4 for Maya 2012+ (osx)
In this article I am going to describe the methods of installation PyQt in your computer. The ways of the installation of the operating system are examined for writing separate independent applications for Maya and Nuke which have an interface that built on Qt. And also for Houdini that not supports Qt but has fairly acceptable facilities for a modification.
How to install PyQt on Windows
First make sure to install Python at your OS. You have to do it if Python wasn't installed. For it you can download Python from the official website. Also you need to download installation exe file from the official website, too and launch the installation process. Further just wait for a some minutes till the process is finished. It's done automatically. Be sure to download a version for your Python interpreter. And don't forget to check the paths of installation.
How to install PyQt on Linux
Run command in a terminal:
sudo apt-get install python-qt4
The installation will run automatically. It was tested by me only on Ubuntu. Other distributions may have some differences. The methods shown above are the simplest. If something is wrong, you can find enough information about the installation for in different cases in the Internet.
Installation PyQt for Maya
To PyQt worked in Maya requires a special distribution that is compiled independently and based on the source from the site of Autodesk for a particular platform and version of Maya. Example assembly instructions may be seen here and here. Also may download pre-comliled packages and just install them.
I am gonna help you and below I'm giving the links to the packages I use by myself. I don't have installers for other versions and platforms.
On Windows
The installation can look like this:
The first way involves the installation by running exe file. In this case you should make sure the folder is the oe of the Maya's interpreter , not a system interpreter of Python. For example, it can have the following address:
C:\Program Files\Autodesk\Maya2012\Python
And after the installation is completed, don't forget to check that the folder placed here:
C:\Program Files\Autodesk\Maya2012\Python\lib\site-packages\PyQt4
On Linux
Usually it looks like an archive with ready files. You need to copy them manually. For example, address would be:
/usr/autodesk/maya2012x64/lib/python2.6/site-packages
Installation PyQt for Nuke
Here all are the same. Either use the installation exe file, or an archive that needs to be extracted to the proper place.
For Windows it may be here:
C:\Program Files\Nuke6.3v4\lib\site-packages
For Linux::
/usr/local/Nuke6.3v8/lib/python2.6/site-packages
Installation PyQt for Houdini
Qt is not used in Houdini as a graphical interface engine (an engine for the construction of the interface) (as it is done in Maya and Nuke) therefore it is suitable to distro from official site. You have to install it in directory of Houdini's interpreter.
The installation path may look like this, for example:
Windows
C:\Houdini12.1.72\python26\lib\site-packages
Linux
/opt/hfs12.1.129/python/lib/python2.6/site-packages
After that you need to find a file called pyqt_thread_helper.py , that's located in the documentation files.
C:\Houdini\2.1.72\houdini\help\hom\cookbook\pyqt\part2\pyqt_thread_helper.py
and copy it to the directory of Python's packages, where PyQt had already been installed .
C:\Houdini12.1.72\python26\lib\site-packages
This file is necessary to launch Qt's windows apart form the daughterly process from Houdini. Here you should notice that the version of PyQt must be for Python 2.6 because this version is used in Houdini ( at the moment writting this article).
How to check successful installation
Below I am gonna write the instructions that will help you to check if the installation PyQt had been successful.
Now I'm going to describe how to check successful pyqt installation on operating systems and applications.
Checking installation for Windows and Linux
from PyQt4.QtCore import * from PyQt4.QtGui import * import sys class qtWindow(QMainWindow): def __init__(self): super(qtWindow, self).__init__() self.show() if __name__ == '__main__': app = QApplication(sys.argv) ex = qtWindow() sys.exit(app.exec_())
You need to save it as a file with the extension .py and run it with the interpreter, on which PyQt was installed. If a window was opened it must mean PyQt was installed successfully. Otherwise it depends on the resulting errors.
Checking installation for Maya
The following code to copy in ScriptEditor and run
from PyQt4.QtGui import * import sys class qtWindow(QMainWindow): def __init__(self): super(qtWindow, self).__init__() c = qtWindow() c.show()
If the window was opened at least it might mean PyQt was installed in a proper directory. If you see the errors about loading PyQt's module, it could mean the installation has been done incorrectly. If errors show that something is not supported or there is a wrong classes of C++ it probably means the packet which has been installed does not fit to the current version of Maya. For example it is from another version or the original package is installed.
If PyQt has been installed correctly in a proper directory python-shell packages of Maya's Interpreter but the system variable PYTHONPATH or the order of the links is such that the link to the original package comes before, system's PyQt will be loaded. In this case you need to fix the PYTHONPATH or use the wrapper to run Maya.
Checking installation for Houdini
Open a window Windows\Python Source Editor and copy this code:
import sys from PyQt4.QtCore import * from PyQt4.QtGui import * import pyqt_thread_helper class qtWindow(QMainWindow): def __init__(self): super(qtWindow, self).__init__() def openUI(): app = pyqt_thread_helper.getApplication() cd = qtWindow() cd.show() app.exec_() pyqt_thread_helper.queueCommand(openUI)The window does not inherit a visual style of Houdini just as it is done in Maya but I will try to explain how it can be done, by creating your own style that reminiscent of Houdini. There is one deficiency when we lose focus at the window, it becomes hidden behind an interface. For Maya and Nuke this problem is solved with standard means, but for Houdini it will be a little more complicated. I will tell about this later, in my next publications.
Checking installation for Nuke
This code to copy in ScriptEditor and run
from PyQt4.QtCore import * from PyQt4.QtGui import * import sys class qtWindow(QWidget): def __init__(self, parent = QApplication.activeWindow()): super(qtWindow, self).__init__(parent) self.setWindowFlags(Qt.Window) c = qtWindow() c.show()
Conclusion
The proposed methods do not tend to be absolutely right and authentic. Because you can't be sure in advance, how problems will not be. But you have a Google and you may find a decision on the forums, you may ask in the comments.
Links
Maya2011 Windows_x64
Maya2012 Windows_x64
4.7.1 for Maya2013 Windows_x64
4.9.1 for Maya2013 Windows x64
In Maya 1014 and above, use the built module PySide
Maya 2012 Lunux x64
Nuke6.3 Windows
Nuke6.3 Linux x64
If you have OSX you can check Justin Israel's Installing PyQt4 for Maya 2012+ (osx)
Спасибо за пост, узнал много нового!
ОтветитьУдалитьWhy use PyQt, if there is PySide. For Nuke 6v5 and greater no need to install Qt.
ОтветитьУдалитьI wouldn't recommend using apt-get for python bindings, better to compile if by hand, or use pip install pyside. No need write code to check PySide installation. Simply open python shell and execute: from PySide.QtGui import *
Good post overall, but too complicated for such a simple task.
This manual for version <6v5
ОтветитьУдалитьI AM VERY RUSSIAN
ОтветитьУдалить