Skip to content
June 12, 2010 / stevebaer

Configuring Pydev for Rhino.Python

https://i1.wp.com/pydev.org/images/pydev_banner2.gif
NOTE: This article is specific to getting Pydev to work on Windows. I’ve had problems getting the ironpython interpreter to work inside Pydev on Mac. Hopefully this will inspire someone to hack away at the Mac version of Pydev and figure out what it takes to make it work for Rhino.Python.

What’s Pydev?
The folks at Pydev can probably do a much better job of explaining their product (http://pydev.org/index.html). In short, Pydev is a popular Python script editor (and debugger). Several python scripters who are familiar with Pydev have asked about how to configure it for editing Rhino.Python scripts.

Rhino for windows already comes with a built-in python editor, but I can understand that people will want to use a different editor for many reasons (they’re familiar with it or it has features that are missing in the Rhino editor.) Here’s the steps I took to get this to work on my Windows 7 computer.

A. Install Pydev – Here’s a page I used to get everything set up for Pydev http://pydev.org/manual_101_root.html
If you’ve already installed Pydev on your computer, you can skip this section.

  1. Download eclipse (http://www.eclipse.org/downloads/).
    I downloaded Eclipse Classic 3.6.1 (~170MB) 32bit version for windows.
    I downloaded the 32 bit version because I haven’t installed the 64 bit version of java on my computer and eclipse requires java to run.
    File name is eclipse-SDK-3.6.1-win32.zip
  2. Unzip file and double click on the eclipse.exe to start eclipse
  3. go to help->Install Software and type the following URL into the Work with text box
    http://pydev.org/updates
  4. You should get checkboxes for available pydev plug-ins. Check the Pydev item and click next, then finish
  5. This installs the pydev plug-in for eclipse

B. Install IronPython Executables
Rhino.Python uses Microsoft’s IronPython engine to process python scripts. Pydev is going to need to use this same engine in order to get things like auto-complete to work.

  1. Go to codeplex and Install “IronPython 2.6.2 for .NET 4.0” http://ironpython.codeplex.com/releases/view/41236
    The download link is in the upper right corner of the web page
  2. This installs the command IronPython command line interpreter which is needed by PyDev

C. Configure Pydev

  1. Start eclipse.exe
  2. Select Preferences from the Window menu
  3. Expand the Pydev node in the preferences tree and select “Interpreter – Iron Python”
  4. Click the “New…” button which brings up a “Select Interpreter” dialog
  5. Click the “Browse…” button and select ipy.exe which on my computer happens to be located at
    C:\Program Files (x86)\IronPython 2.6\ipy.exe
  6. Click OK and then another OK to accept the default folders added to the SYSTEM pythonpath
  7. Add the lib folder that contains the rhinoscript package to the system python path in order for Pydev to recognize any of the rhinoscript functions
  8. On the Libraries tab click click the “New Folder” button and pick the directory where the rhinoscript package is located. You can find this folder location by looking at the Paths in the built-in Rhino.Python editor. On my computer this directory is located at
    C:\Users\a-steve\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib

  9. Add RhinoCommon as a “Forced Builtin”. In order to do this we need to create a directory that will be on the python path. I created a new folder in the eclipse directory called pydevrhino and added it to the python path by clicking the “New Folder” button on the Libraries tab and selecting this new folder. On my computer, this folder is located at
    C:\Users\a-steve\Desktop\eclipse-SDK-3.5.2-win32\pydevrhino
  10. Pydev has a limitation where it can only read .NET assemblies with a root namespace the same as the dll. We want to get at all of the classes inside of RhinoCommon.DLL, but the root namespace in this DLL is Rhino. Go to the Rhino5 system folder (where the main executable is located) and copy RhinoCommon.dll (and RhinoCommon.xml) to the new folder that you created in the previous step. In the new folder, rename these files to Rhino.dll and Rhino.xml (DON’T CHANGE THE FILES IN THE RHINO SYSTEM DIRECTORY).
  11. Go to the “Forced Builtins” tab, click New… button and type in “Rhino”.

D. Start Using Pydev
Good luck!

5 Comments

Leave a Comment
  1. Yaniv Corem / Feb 4 2015 9:08 pm

    Hi Steve,

    Thanks for posting this…I followed your set up but am getting this error:
    AttributeError: ‘LightException’ object has no attribute ‘Host’

    Any ideas what could be causing it?

    Thanks!

    • stevebaer / Feb 7 2015 4:21 pm

      Sorry, I don’t. It’s been 4 years since this post and quite a bit may have changed in both the current Rhino and pydev since then.

  2. Dimueter / Jun 21 2015 2:09 pm

    Thanks a lot. All works like a charm. (Eclipse Luna)

  3. jacobo bouzada jaureguizar / Nov 17 2015 7:51 pm

    Just installed in Win7 (w/ Mac BootCamp). Works perfectly !!!!.
    Thanks.

  4. Miriam Dall'Igna / Oct 12 2016 10:38 am

    Hi Steve,

    Thank you for this post.

    I just got a new machine (yay :)) and had to set up the workflow again. I had some troubles and I documented them, so I thought of sharing their solutions, it mabe useful for somebody.

    Here is a link:

    https://www.dropbox.com/s/g6jgpvbqy7564i2/PydevRhinoGrasshopper_SetUpGuide.pdf?dl=0

    Cheers,
    Miriam

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: