PySide conflict

Hey all - if I want to use the FabricEngine python module, then I have to add $FABRIC_DIR/Python/$PYTHON_VERSION to my PYTHONPATH. However, doing this will also make Maya pick up fabric's bunlded version of PySide - which throws this error if I import PySide.QtGui:

import PySide.QtGui
# Error: /blah/FabricEngine-2.3.0-Linux-x86_64/Python/2.7/PySide/QtGui.so: undefined symbol: _ZTI9QGtkStyle
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
# ImportError: /blah/FabricEngine-2.3.0-Linux-x86_64/Python/2.7/PySide/QtGui.so: undefined symbol: _ZTI9QGtkStyle # 

I'm using:

Fedora-19
Maya-2016 Ext 2 SP1
FabricEngine-2.3.0-Linux-x86_64

Is it safe to remove PySide from fabric, assuming we have our own copy on the path? Ideally, PySide would be in a separate directory from FabricEngine, so we could have one without the other...

Comments

  • Roy NieterauRoy Nieterau Posts: 258 ✭✭✭

    Instead of adding these manually to the PYTHONPATH add the Fabric Engine maya module to the MAYA_MODULE_PATH.

    Also see: http://docs.fabric-engine.com/FabricEngine/2.2.1/HTML/GettingStartedGuide/dccinstallation.html#installing-fabric-for-maya

    This should take care of setting the correct environment variables for you that will work with Maya. That works for me. :)

  • barnabas79barnabas79 Posts: 20
    edited September 2016

    I am using MAYA_MODULE_PATH - but in effect, all that does is modify a handful of environment variables automatically - MAYA_SCRIPT_PATH, XBMLANGPATH, MAYA_PLUG_IN_PATH, etc.

    On a more fundamental level, though, the way that the directories are arranged, there's really no way to make the FabricEngine python modules available for import, without also exposing fabric's own copy of PySide. In the case of maya's PySide libraries, these are installed in it's python installation's site-packages directory - a directory which isn't even on the PYTHONPATH, but is always automatically added to sys.path by the interpreter itself - AFTER everything on the PYTHONPATH. The only way to make maya's PySide take precedence is to either manually add it's own site-packages onto the PYTHONPATH, at a higher priority - but this becomes tricky, because there's other things in maya's site-packages that we DO want to override. (Also, adding site-packages to the PYTHONPATH and bumping it's priority is somewhat against common convention.) The only other solution is to simply remove/rename fabric's copy of PySide, which is what I'm doing for now.

    Which raises the question - in what situations do we need fabric's PySide? This seems to be a somewhat recent inclusion - the last version of fabric I was testing, 2.0.1, didn't include PySide, and seemed to work with Maya out of the box. (We also had fewer problems getting Canvas running with that version - I still haven't been able to do that successfully with 2.3.0, regardless of whether fabric's PySide is present or not. But that's probably a topic for another thread...)

  • borjaborja Administrator, Fabric Employee Posts: 480 admin

    Hi @barnabas79

    Fabric's Pyside was added in 2.2.0 to support the python bindings of FabricUI and the addition of a python implementation of Canvas.
    The version we use should be compatible with Maya, so if you don't want to use canvas.py you can move the folder.

    In any case, I just tested in Windows and Linux (Centos 6) with Maya 2016 extension 2 and importing PySide.QtGui works as expected by just setting the MAYA_MODULE_PATH to the Fabric for Maya folder). Do you have other systems with a different maya version to see if you can reproduce it?

    Borja Morales
    Technical Product Manager
    Fabric Software Inc.

  • borjaborja Administrator, Fabric Employee Posts: 480 admin

    Hi @barnabas79

    Going back to your problem, the cause of it is that you are manually adding $FABRIC_DIR/Python/$PYTHON_VERSION to your PYTHONPATH when this is not needed. FabricMaya.mod will automatically extend PYTHONPATH with the python/2.7 folder inside the plugin dir, which has the FabricEngine bindings but not PySide (the system one will be used).

    To summarize, to run the plugin you only need to define the MAYA_MODULE_PATH env variable to point to the folder of the Fabric for Maya plugin (where FabricMaya.mod is located).

    Borja Morales
    Technical Product Manager
    Fabric Software Inc.

  • barnabas79barnabas79 Posts: 20

    If I don't manually add to the PYTHONPATH, then I can't import the FabricEngine module - which means, among other things, I can't use Kraken.

  • borjaborja Administrator, Fabric Employee Posts: 480 admin

    If you use the FabricMaya.mod as it is given, it will append to the PYTHONPATH +:= python/2.7 and load the FabricEngine module (found on the FabricMaya2016.5\python\2.7\FabricEngine folder). Is this not the case?

    Borja Morales
    Technical Product Manager
    Fabric Software Inc.

Sign In or Register to comment.