Author Topic: Q&A: Maya gives "ImportError" and other python errors at launch  (Read 9561 times)

Scot Brew

  • Hero Member
  • *****
  • Posts: 272
    • PipelineFX
Question: I am getting some "ImportError" messages and "unable to find Maya's Python modules" messages.  What's going on?

Answer: Maya rendering is sensitive to a python environment variables.  In particular PYTHONHOME.  If it is set, then Maya will likely fail.

Note: This PYTHONHOME is currently set in the QubeGUI on OSX if the export_environment job flag is set.  That environment varaible will be explicitly removed in the QubeGUI (releases 5.4.7 or 5.5.0) when starting a Maya job. 

Success Test Case
Code: [Select]
$ ./Render myscene.ma

Starting "/Applications/Autodesk/maya2008/Maya.app/Contents/bin/maya"

mental ray for Maya 9.0
mental ray: version 3.6.1.6, 17 Jul 2007, revision 21668

FBX Plugin load location: '/Applications/Autodesk/maya2008/Maya.app/Contents/MacOS/plug-ins//fbx'
File read in 0 seconds.
Result: myscene.ma
Total Elapsed Time Since Start Of Maya (hh:mm:ss): 00:00:06
...

Failure Test Case
Code: [Select]
$ export PYTHONHOME=/Applications/pfx/qube/qube-5.4.6.app/Contents/Resources
$ ./Render myscene.ma

Starting "/Applications/Autodesk/maya2008/Maya.app/Contents/bin/maya"

ImportError: No module named maya.app.python
Invalid Python Environment: Python is unable to find Maya's Python modules
Python Evironment:
  PYTHONHOME = /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources
  System modules located at: /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources/lib/python2.5
  Python cannot find sys module!
ImportError: No module named maya.app.python
Invalid Python Environment: Python is unable to find Maya's Python modules
Python Evironment:
  PYTHONHOME = /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources
  System modules located at: /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources/lib/python2.5
  Python cannot find sys module!
ImportError: No module named maya
ImportError: No module named maya.cmds
ImportError: No module named maya.utils
ImportError: No module named maya.mel
ImportError: No module named maya.app
Invalid Python Environment: Python is unable to find Maya's Python modules
Python Evironment:
  PYTHONHOME = /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources
  System modules located at: /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources/lib/python2.5
  Search path (sys.path):
    /Applications/Autodesk/maya2008/Maya.app/Contents/MacOS
    /Applications/Autodesk/maya2008/Maya.app/Contents/bin
    /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources/lib/python25.zip
    /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources/lib/python2.5
    /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources/lib/python2.5/plat-darwin
    /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources/lib/python2.5/plat-mac
    /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources/lib/python2.5/plat-mac/lib-scriptpackages
    /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources/lib/python2.5/lib-tk
    /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources/lib/python2.5/lib-dynload
    /Applications/pfx/qube/qube-5.4.6.app/Contents/Resources/lib/python2.5/site-packages.zip
mental ray for Maya 9.0
mental ray: version 3.6.1.6, 17 Jul 2007, revision 21668

FBX Plugin load location: '/Applications/Autodesk/maya2008/Maya.app/Contents/MacOS/plug-ins//fbx'
ImportError: No module named maya.app.startup.batch
File read in 0 seconds.
Result: myscene.ma
Total Elapsed Time Since Start Of Maya (hh:mm:ss): 00:00:06
...