Search code examples
pythonpyqt4mayapython-sip

Using PyQt4 & sip for shared maya script - how to set up modules?


I want to use PyQt4 and sip in a shared maya script. I figured I can't use pip-install because I would only get these modules locally on my machine. I manually extracted these folders into my script directory. I can import both PyQt4 and sip but I can't run any commands from the modules "QtGui, QtCore" and so on. Is it possible to do it this way or do I have to install these modules? If so what is another solution to use PyQt4 in a shared script? Here are some import scripts I tried:

import sys
from python_modules.sip import *
from python_modules.PyQt4 import *

app = QtGui.QApplication(sys.argv)

Gives error:

'module' object has no attribute 'QApplication'

I Also added _.init._.py to python_libraries, sip & PyQt4 folders.


Solution

  • For every version of maya, there is a page in around the corner explaining how to install PyQt for maya as maya is using a custom python package "mayapy", the install is a bit painfulbut...

    around the corner

    Also, it has been few versions of maya which embbed PySide, it might be easier than installing PyQt on every machine depending of your privileges.