Search code examples
pythonmayanose

Is there any way to install nose in Maya?


I'm using Autodesk Maya 2008 on Linux at home, and Maya 2012 on Windows 7 at work. Most of my efforts so far have been focused on the former. I found this thread, and managed to get the setup there working at home. The gist of it is that you install nose for whatever Python you have installed on your system, then create a py script that adds that nose egg to sys.path, and loads in the maya.standalone module, then imports nose and runs it. Then you run that py script through Maya's version of Python (mayapy in the maya directory structure).

I'm unsure if running a Python 2.6 install of nose in Maya 2008's baked-in Python 2.5 installation is of concern. Moreover, it's just a more messy setup, and I'd like to do this for many coworkers. It would be nice to install nose right into Maya 2008 (Python 2.5) and 2012 (Python 2.6).

To that end, I tried downloading nose and installing it via Maya's mayapy executable:

~sudo /autodesk/maya2008-x64/bin/mayapy setup.py build
running install
error: invalid Python installation: unable to open /autodesk/maya2008-x64/lib/python2.5/config/Makefile (No such file or directory)

There's no config folder in there. Apparently this has to do with a missing python-dev. I have that installed, but out in the system version of Python. I don't know how to install it for Maya's Python, or if it's even possible. Is it? Is Maya's version of Python too crazy/one-off to even consider this?


Solution

  • Since nose is a pure-Python package, it is safe to force it onto the sys.path of Maya's built-in Python.

    The worst that I believe could happen is some *.pyc thrashing if you use the same nose installation with another 2.X version of Python. Over here, Maya 2011 and 2013 use Python 2.6.4 on OS X and Linux, so I just make sure to add a version installed into a python2.6/site-packages directory.

    This generally holds for compiled packages as well, enabling us to build PyQt4 for Maya as well.

    I have been doing this without consequence for a few months now, even going so far as to add it to the sys.path of a running Maya GUI in order to write tests against the GUI!