Search code examples
pythonmacosqtmaya

OSX: Maya Python Qt conflict with system libraries


I'm trying to workaround conflicting Qt libraries, which are causing Maya to crash. When I run Maya from terminal, I get:

objc[4152]: Class QCocoaColorPanelDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QMacSoundDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaPanel is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaView is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaWindow is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaWindowDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaMenuLoader is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSApplication is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaApplicationDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaWindowCustomThemeFrame is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaToolBarDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaMenu is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSOpenSavePanelDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaFontPanelDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSPanelProxy is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSWindowProxy is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaPageLayoutDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaPrintPanelDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSImageView is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSStatusItem is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSMenu is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.

My workaround was to implicitly set up PYTHONPATH environment variable pointing to Qt library:

/Applications/Autodesk/maya2016/Maya.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

But that's causing other applications using Qt to link to Maya's custom Qt build, producing another conflicts (different builds and Python versions).

I'm guessing that's an OSX-specific question. How to force applications to run their own Qt libraries?

Edit: I removed Qt, PySide and Shiboken packages installed with brew to check if they were picked-up by Maya. With no PYTHONPATH set, PySide is still picked-up from system directories:

import PySide
PySide.__file__
# Result: /usr/local/lib/python2.7/site-packages/PySide/__init__.pyc # 

Solution

  • I had the same issue today, and solved it. So this might help.

    First check your sys.path from inside maya:

    for p in sys.path:
        print p
    

    You should now see that it's wrongly listing /usr/local/lib/python2.7/site-packages/

    A few reasons:

    • You are setting the PYTHONPATH in your profile (.bashrc,.profile,.zshrc ...) and running Maya from the command line. In this case you have two options. Either remove the PYTHONPATH from your profile or add an alias that does it for you before running Maya,

      Something along those line: alias maya=export PYTHONPATH="";/App/Maya/macos/maya

    • You have a .pth file somewhere that link to /usr/local/lib/python2.7/site-packages/. Just check in the list of folders returned by sys.path.

    Hope it helps