Eclipse Python and Maya Setup – Making Eclipse Soar

Here is a guide to set up and get Eclipse, PyMel, PyQt4 & Python to work together. When complete, you will have a sweet IDE setup, switch between running everything 32bit and 64bit native AND the ability to compile your own 64 and 32 bit native applications. I am writing this assuming Windows 7 64 bit. I would recommend sorting all the downloads into a 32 and a 64 folder to easier keep track of everything.

Getting The Installers

Python

Python x64 – http://www.python.org/download/#id5 – Python 2.6.5 Windows X86-64 installer
Python x32 – http://www.python.org/download/#id5 – Python 2.6.5 Windows installer

Java Virtual Machine (Runtime Environment) x64 (we only need the 64 bit version of this)

Sun Download Portal – Select Windows x64, agree to the licence agreement → Continue → jre-6u38-windows-x64

Eclipse – We only need the 64 bit version for this one

http://download.eclipse.org/eclipse/downloads/ – Latest Release → eclipse-SDK-4.2.1-win32-x86_64

PyQt4 – We want PyQt4 for Maya 64 bit, PyQt for external Python 64 bit, PyQt for external Python 32 bit

Note: If you have not done so, I highly recommend a switch to PySide – It will always be included in Maya.

Props to Nathan Horne for compiling these and sharing with the community:
Maya 2011
PyQt4 x64 – http://nathanhorne.com/?p=204&cpage=1#comment-1978 – Download the 3 files on this post.
Maya 2012
PyQt4 x64 – http://nathanhorne.com/?p=322
Maya 2013
PyQt4 x64 – http://nathanhorne.com/?p=460
PyQt For Standalone Python installs
PyQt4 x32 & x64 – http://www.riverbankcomputing.co.uk/software/pyqt/download

In case you need to compile your own 64 bit version in the future here are resources for standalone and Maya compiles:
Standalone – http://eoyilmaz.blogspot.com/2009/09/how-to-compile-pyqt4-for-windows-x64.html
Maya 2011 – http://images.autodesk.com/adsk/files/pyqtmaya2011.pdf
Maya 2012 – http://images.autodesk.com/adsk/files/pyqtmaya2012.pdf
Maya 2013 – http://images.autodesk.com/adsk/files/pyqtmaya2013.pdf

Getting Up & Running

Install Python

If you want to run both 32 and 64 bit and compile both 32 and 64 bit programs, install the 64 to C:/Program Files/Python26/ and the 32 to C:/Program Files (x86)/Python26/

Install PyQt4

Install the PyQt-Py2.6-gpl-4.7.3-1 to where you installed Python26 64 bit to.
Replace the sip.pyd with the downloaded one.
Install the PyQt-Py2.6-gpl-4.7.3-1_QT_MAYA (the installer my prompt you to uninstall PyQt. Ignore this and just point the installer to Maya install loc/python/)

Install Java64
Unzip Eclipse64

Unzip it to C:/Program Files/ – you can put it wherever, but this location makes sense to me…

Launch Eclipse

Do NOT pick your main tool folder as the default workbench, pick some other spot (I picked C:/ or myDocuments).

Adding Goodies To Eclipse

PyDev
  1. Go to Help → Install Software
  2. Name it something (PyDev) and paste this path in the location field → http://pydev.org/updates
  3. In the Available Software Window, you now have a new entry under the Work With drop down list. Select PyDev Address.
  4. Jump through the steps and install PyDev, then restart Eclipse
Perforce
  1. Go to Help → Install Software
  2. Name it something (P4) and paste this path in the location field → http://www.perforce.com/downloads/http/p4-eclipse/install/4.2
    Depending on which version of Eclipse you are using you can find out which Perforce plug in you should be using here
  3. In the Available software window you now have a new entry under the Work with: drop down list, select P4 – address
  4. Jump through the steps and install Perforce and restart Eclipse
XML Formatter
  1. Download XMLBuddy to your computer – http://download.cnet.com/XMLBuddy/3000-7241_4-10405546.html
  2. From the xmlbuddy_2.0.72.zip, extract com.objfac.xmleditor_2.0.72 into C:/Program Files/eclipse/plugins
Maya Connection
  1. Download MayaEditor – http://www.creativecrash.com/downloads/eclipse-maya-editor/download
  2. Put the com.myplugin.eclipseMayaEditor_1.0.0.jar into C:/Program Files/eclipse/plugins
  3. After reboot, read the creative cash link above. Most important to this one is to add the port connect to userSetup.mel so that Maya can connect to Eclipse.
  4. In Eclipse Window → Preferences → Maya Editor Preferences. You see some doc links that you can launch within Eclipse, which is handy. I set mine to this:
    – Maya Python API Doc Path →  http://download.autodesk.com/us/maya/2011help/API/classes.html
    – Maya Python Commands Doc Path →  http://download.autodesk.com/us/maya/2011help/CommandsPython/index.html
    – Pymel Doc Path →  http://www.luma-pictures.com/tools/pymel/docs/1.0/index.html
    – I changed the WPF Doc Path to contain the PYQT Class Reference →  http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/classes.html
Mel Syntax Highlighting
  1. Download dk.maya3d.melEditor_0.5.0.jar into C:/Program Files/eclipse/plugins
Adding The Maya Interpreter
  1. In Eclipse, Go to: Window→Preferences→ Pydev→Interpreter – Python
  2. Top section will list all your available interpreters, Click New…
  3. For Maya 2013 add C:/Program Files/Autodesk/Maya2013/bin/mayapy.exe
  4. Check all the checkboxes and click OK
  5. Auto completion (PyMel & Maya Python API) – In the section below Python Interpreters, you will see a series of tabs. Click on Predefined
  6. Inside the Predefined tab, click new and navigate to: C:/Program Files/Autodesk/Maya2013/devkit/other/pymel/extras/completion/pypredef. Select the pypredef folder and click OK.

Add the Python Interpreter (with PyQt4 Autocompletion)
  1. In Eclipse, Go to: Window→Preferences→ Pydev→Interpreter – Python
  2. Top section will list all your available interpreters, Click New…
  3. Pick the C:/Programs/Python26/python.exe, name the interpreter Python26-64
  4. In forced buildins add “PyQt4″ and “sip”
  5. Rinse and repeat for 32 bit Python and name that interpreter Python26-32
Adding the Py dev project(s)
  1. In Eclipse, make sure that you have the pyDev Perspective active: Window→ Open Perspective→ Other…→ Pydev
  2. In Eclipse, make sure that the PyDev Package Explorer is open: Window→ Show View→ Pydev Package Explorer
  3. In the Pydev Package Explorer, Right click and select New→ project→ Pydev(folder)→ Pydev Project (Click Next)
  4. Give the project any name in the Project name: field
  5. Uncheck Use Default and Create defualt ‘scr’ folder. You can choose an interpreter here, but you can change this at will for the project at any time by going to project properties. If you do know which one you prefer, go ahead and set it (mayaPy2011 interpreter, for a Maya tool project for instance)
  6. When you unchecked Use Default, the Directory Path unlocked. Click Browse and select the top directory of your tool folder.
  7. Click Finish
  8. Right click on your project →Properties→Pydev – PYTHONPATH. Add source folders here to your code base for this project. You can also add source folders between projects, by using External Libraries.
  9. Rinse and repeat to add as many projects as you want.
  10. To set and change the interpreter on a project by project basis (Maya Interpreter for any tool depots that relates to Maya & Python Interpreter for external compiled tools for instance). Right click on your project – Properties→ Pydev – Interpreter/Grammar. Pick one of your defined interpreters in the Interpreter drop down.
Great PyQt Reference as a PyDev Project (the PyQt Examples Library)
  1. Right click and select New→ project→ Pydev(folder)→ Pydev Project
  2. Uncheck Use Default and Create Default scr folder
  3. Browse to C:Program FilesPython26Libsite-packagesPyQt4
  4. Select the Python26-64 interpreter (if you added the C:Program Files(x86)Python26Libsite-packagesPyQt4, select the Python26-32 interpreter)
  5. Click Finish
  6. Right click on Project Name You Gave It→ Properties→ Pydev-PYTHONPATH – add Examples under source folders.
  7. Click OK, you now can view and run source code for tons of powerful pyQt examples. It’s a great way to learn….
Adding the Py Dev Project(s) to P4
  1. Right click on a project→ team→ share project→ Perforce
  2. Set up the perforce settings and apply

Real Time Debugging Maya In Eclipse

  1. Set a break point in a python script that will be run from Maya.
  2. Go to debug view/mode in Eclipse and start the debug server.
  3. Call this from Maya to connect (This utility was written by Jason Parks).

def connectToEclipse(host='localhost'):
"""
SYNOPSIS
Connects to Eclipse PyDev debug server
 
INPUTS NONE
 
RETURNS: Nothing
"""
#import pydevd
from diagnostics.pydevDebug import pydevd
try:
    pydevd.settrace(host=host, stdoutToServer=True, stderrToServer=False, suspend=False)
    print 'Connected to Eclipse'
except: print 'Could NOT connect to Eclipse'
  1. To connect remotely to other people and debug their Maya from the comforts of your workstation, set up a Maya call that replaces ‘localhost’ with your machine network name.
  2. Refer to this when it comes to the intricacies of debugging in Eclipse – http://pydev.org/manual_adv_remote_debugger.html
    NOTE: You can copy the code from the python widget by double clicking once then copy.

Trouble Shooting, Tips & Tricks

  1. If your Eclipse get a java resource crash (using up all available cache), you can increase it by opening – C:/Program Files/eclipse/eclipse.ini. These are the settings I run with and I have not have a resource crash since:

--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.0.200.v20090519
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Xms512m
-Xmx1000m
  1. Pymel is no longer autocompleting (can sometimes happen when you jump between interpreters…) – Click Force restore Internal Info Button (Right click on your project → Properties→ Pydev-PYTHONPATH) also select your PyDev project and refresh (F5).

Setting Up To Compile Your Own External Tools (.exe’s)

py2exe
  1. Download the latest release for Python 26 (grab both 32 and 64 bit) – http://sourceforge.net/projects/py2exe/files/
  2. Install the py2exe-0.6.9.win64-py2.6.amd64 to C:/Program Files/Python26 and the 32 installer to C:/Program Files(x86)/Python26.
GUI2EXE – Nice front end for a host of compilers
  1. Dowload GUI2EXE – http://code.google.com/p/gui2exe/
  2. Unzip this to anywhere on your HD
  3. Before running it, install the 64 bit and 32 bit version of wxPython2.8 (required to run GUI2EXE) –http://www.wxpython.org/download.php#binaries
  4. Install the 32 bit to C:/Program FIles (x86)/Python26, and the 64 bit to C:/Program FIles/Python26.
  5. To get gui2exe to run, right click on the gui2exe.py and in the first tab of properties, set open with 64 bit pythonw.exe – C:/Program FIles/Python26/pythonw.exe.
  6. Now you can double click GUI2EXE and compile your own 64 bit and 32 bit Python based programs. In GUI2Exe, go to Options→ Change Python Version…. to swap between compiling for 32 and 64 bit. If you use PyQt for your interface, don’t forget to add sip to included modules…..
  7. To compile you have to pick one of the many Python addons to do so. I use Py2exe
  8. To include external modules from your code base, Go to Options→ Add Custom Code. Import sys and sys.append python paths so that the compiler can find the libraries that you are using in whatever tool you want to compile.
  1. You now have one hell of a IDE set up with the capability to generate 64 and 32 native applications from your Python code.
    Happy Scripting!!/Christian Akesson
37 replies
  1. dan
    dan says:

    Great tutorial, there’s nothing like this anywhere else so thanks for taking the time to do it. Inevitably though I do have a question! I’m not getting any MEL highlighting even though the plugin is in the correct directory. Is there a way to activate it or to check that it’s been recognised by Eclipse?

    Reply
    • cakesson
      cakesson says:

      Thanks Dan. One way to check is to go to Window->Preferences. Look under General->Editors->File Associations and make sure that *.mel is listed. If not, add it in there….

      Hope that helps,
      /Christian

      Reply
  2. Lane Daughtry
    Lane Daughtry says:

    Wow. Christian. This is incredible. This solves a major hurdle we were encountering at the studio.

    -L

    Reply
  3. bclark
    bclark says:

    Fantastic walk-through!

    One question though: I’ve seen implementations of this that seem to have a lot of documentation on the commands in the autocomplete suggestion box, however I can’t seem to get that, only the names. Do you have any thoughts or suggestions?

    Thanks!

    Reply
    • cakesson
      cakesson says:

      It may be a PyDev option to display documentation in a pop up window. Will check on that next time I am in front of my machine…

      Reply
    • cakesson
      cakesson says:

      I am not sure Bryce. I tend to send python class reloads and running methods on classes across. By that methodology, the lines that are in effect run are endless.

      Have you hit that limit? How many lines are you trying to send?

      / Christian

      Reply
  4. alexisp
    alexisp says:

    Thanks a lot, really nice tut.
    However I got few issues with the remote debugger.
    First the debugger stop on every single line, breakpoint or not, it’s quite annoying when you’re executing more than 10 lines.
    Other “issue”, the script editor is nicely updated while I progress in the debug (line by line ^^) but the viewport doesn’t update, is that an expected behavior ?

    Thx in advance 🙂

    Reply
    • cakesson
      cakesson says:

      Yea, that is expected. We managed to force a viewport update by putting in a watch variable and then refresh() as a separate watch variable, which would continuously refresh the viewport. This was all done in Wing and I am not sure if something similar could be done in Eclipse. It’s worth a try though…

      Looking really quickly it does look like you can make a watch expression in Eclipse. Try making one and in a separate line underneath put refresh() and see if that works for you…

      /Christian

      Reply
      • alexisp
        alexisp says:

        I found the refresh() trick, but i thought it might be a more conveniant way to do so.

        Thx for everything.

        Reply
  5. Harshad
    Harshad says:

    Hi there, ive been using eclipse going through your tutorial since some time now. Ive a query to ask:
    Im planning to create a Eclipse -perforce workspace which should be synced with another friend of mine living in another country. So i am looking for solutions to sync my workspace over the web. There are some dropbox solutions on the web too. Can you point me in the right direction if you have any ideas? Thanks a lot.

    Note: your tutorial made me escape the frustrations of setting up a perfect eclipse workspace. 🙂

    Reply
    • cakesson
      cakesson says:

      Yea, I don’t see a reason you couldn’t Perforce the workspace or even dropBox it. Your paths and code environment would have to be set up the same way (code on the same letter drive and path etc…) We have done this in Wing at work but I have not tried Eclipse.

      Tell me how that goes…

      /Christian

      Reply
  6. studioAK
    studioAK says:

    Credit where credit’s due, mate! I’ve had to install dev environments on multiple machines, and this blog has been my consistent “go-to” checklist. Thanks for taking the time to put this together! On a side note, I have a few other reference pages for testing my userSetup.mel and checking my host:port connections (netstat and/or ProcNetMonitor). Perhaps you could append a little note to section 3 of the Maya Connection heading? Thanks again for the hard work in compiling this! Couldn’t have done it without ya, man!

    Reply
    • cakesson
      cakesson says:

      Thanks a lot, I appreciate it! I can definitely make that part of the section when I iterate and add a few other great pointers that has come up here.

      Cheers,
      /Christian

      Reply
  7. Joh
    Joh says:

    Thanks Christian for this how-to, helped me a lot 🙂
    Btw I experience High CPU usage as soon as I connect Eclispe with maya, the java process goes to 100%.

    I tried on Linux as on Windows 7, with different Eclipse version (from 3.4.1 to 4.1) and both maya 2011 and 2012 but still the same problem of CPU usage with mayaEclipse.
    Thanks

    Reply
  8. Kumar
    Kumar says:

    I think the link to the latest Java runtime is wrong. Could be changed to update it.
    Any other updates for the latest versions for maya 2012 or should i just follow what you have written

    Reply
  9. Kumar
    Kumar says:

    Ok i am having some problem with eclipse 3.7 and the manual installation of the PyDev. Not sure if its issue. But i will try the 3.6 and see if it works

    Reply
    • cakesson
      cakesson says:

      Sorry to hear that Kumar! Yea, I am still running this exact setup in Maya 2012. Haven’t had the time to add the 2012 interpreter so I am still using the 2011 one for my tool dev. We updated our Maya environment with new PyQt and latest Pymel…

      Reply
  10. cgjedi
    cgjedi says:

    I recently improved some Maya/Eclipse functionality. Since the older mel plugin has not been updated in years and does not function anymore, I added a mel option for the Colorer plugin.

    I also updated the Maya Eclipse plugin to now support send/receive mel script, to deal with the high machine resource issues, revamp the doc options and also change how to install the plugin. I’ve modified my tutorial found at CreativeCrash.com

    Reply
  11. Christian Akesson
    Christian Akesson says:

    Big update and refreshed set up coming very soon. I am in the process of updating this whole setup (new machine at work 🙂 ). Going with the latest and greatest. Will report and update as soon as I know the set up is stable and sound.

    Reply
  12. Gerardo
    Gerardo says:

    Hi Christian, You step by step tutorial on how to setup Eclipse is really great.

    Have you tought to record a video tutorial and update it to youtube?

    Some times things get quick and clear looking at the teacher playing in the blackboard.

    Cheers.

    Reply
    • cakesson
      cakesson says:

      Great idea Gerardo, especially for the steps that it will cater well to (adding interpreters and projects and maybe a few other steps). Thanks for the input.

      Reply
  13. Gerardo
    Gerardo says:

    Wow you replay reaply really fast !!!!

    Thanks cakesson to think in future video tutorial. I guess everyone will love it.

    Just a quick thing regarding color highlights for .mel The only way I found to get colohighlights for mel was following this thread:

    http://tech-artists.org/forum/showthread.php?2276-Eclipse-and-Maya-2012&p=20060#post20060

    Now that I have color highlights for mel via the colorer plugin for Eclipse I need to discover how to change the colors to get same scheme as in maya console.

    Once I have that discovered I will post it here too.

    Reply
    • cakesson
      cakesson says:

      Cool. I script very little MEL these days. My MEL calls usually go through PyMel’s mel.MelFunctionName(flag=value, otherFlag=value).

      Very handy and let’s you stay in the Python syntax style.
      If you figure out what you need, feel free to post.

      Reply
  14. Gerardo
    Gerardo says:

    Hi cakesoon, Thanks for your tip!!!
    I will take this month the Shaun Friedberg Python course for maya as I really need to start using it asap.
    http://workshops.cgsociety.org/courseinfo.php?id=351
    I’m in the making of a video tutorial

    I guess I will learn cool things there so I will be in touch with you to talk about python soon.

    In the mean while I am making a video tutorial to help everybody and covering how to install all from scratch. I found how to change the editor to have .mel syntax highlights with same colors as in Maya/Console and I will explain that too in the video.

    Just one question:
    Are you using the Python stand alone version 2.5.6 in x32 and x64 flavors for some reason?

    I am running win 7 ultimate and maya 2013 x64. In my test everything goes well using python 2.7.3
    Per my research Python 2.5.6 is outdate due to security bug fixes http://www.python.org/getit/releases/2.6.5//

    Let me know if I need to take some special consideration on that.

    Cheers.

    Reply
    • cakesson
      cakesson says:

      I am installing both 32 and 64 bit Python so that I can compile my own 64 and/or 32 bit Python standalone programs.

      You can go with any version for your external interpreter…..

      Reply
    • cakesson
      cakesson says:

      As you learn, Python in Maya, make sure you leverage PyMel.
      I have an overview in my blog post on how to create and implement a company wide art pipeline.

      There is a section in that very long blog post that you will benefit from.

      It describes the fundamental differences between maya.cmds (autodesk’s original implementation) and pyMel (open sourced initiative that made Maya’s Python implementation truly object oriented as well as more Pythonic). The latter has since been integrated into Maya by Autodesk.

      Have fun learning! There are also tons of resources online since Python is such a popular language (I taught myself using only online resources, coming from MEL)

      Reply
  15. Gerardo
    Gerardo says:

    Hi Christian, Thanks a lot for the PyMel suggestion.

    I will read the pipeline implementation soon as it looks greate and a good place to start learning concepts and technics!!!
    A good Technical Pipeline is mandatory this days.

    In honor to your great help in writting this post I have recorder a video tutorial following your lead and steps from other authors to Install all from scratch so, I guess it will be usefull to anybody.

    Sorry If I misspell some words. English is not my natal language. 😉

    Enjoy the journey !!

    http://www.youtube.com/playlist?list=PLiAtYD6WcUJ3tk6reqjqgmS7e5u0dIE33&feature=view_all

    Kindest regards.

    Gerardo Verrone.

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply to Harshad Cancel reply

Your email address will not be published. Required fields are marked *