You made some cool scripts for Maya and would like to, say write statistics data out so you can validate between versions, or visualize data so you understand what’s happening in your algorithm. Standard python has a couple of features to help you along, but you are destined to need a module or two.
PyPI is the go-to-repository to find and download new packages. There are a couple of different ways to work with PyPI, where you can:
– download the packages manually from the PyPI site and install using pythons built-in distutil.
– Install setuptools and use its easy_install to install packages from PyPI.
– install PIP from easy_install and use it to install packages from PyPI.
By using distutil you have to take care of dependencies yourself and your more prone to mess up. That’s why it is safer to use a manager, where setuptools was the first one out and PIP is its successor. Without having much knowledge of the intricacies it seems that PIP deals with dependencies, uninstalling and cleaning up better.
Installing Setuptools for Maya
1. Download ez_setup.py from here (just click ctrl-s and save the file to your harddrive) (if you want to keep it simple, put it straight in the c drive).
2. From the documentation we are told to install by running ez_setup.py. This would run the installer with your standard python distribution but we are trying to install it for Maya. Therefore we have to manually call Maya’s python to execute the file. Open a commands window by accessing the start menu and type cmd and hit enter.
3. Lets change the directory to where we can find mayapy.exe. type cd c:\Program FIles\Autodesk\Maya2014\bin and hit enter
4. Call mayapy.exe to install setuptools by writing mayapy.exe c:\ez_setupt.py .
5. Let the process run and validate the installation after its finished by opening Maya’s python interpreter and import setuptools
6. Normally you would run easy_install or pip through a commands prompt, but If you have a standard python with easy_install on your system all calls would go to this one instead of your Maya python. You could specify the path to Maya python every time you want to install a new package or edit the environment variables. But for now, lets test easy_install through Maya’s python interpreter; we are going to install xlrd, a package that will let you load and read spreadsheets(excel files).
Type and run: easy_install.main( [“xlrd”] )
You can either specify an address to a package or use a search term. We used a search term, and we can see that easy_install found a match and installed it.
This is a fast method to install external packages for Maya. It will not let you install numpy or larger additions to python, this requires more hands on handling. And you might find that some packages you want to install with easy_install depends on those additions to python, so it might be good to look into them. Good luck!