Wednesday, May 26, 2010

Setting up PyDev on Eclipse for 64 bit Vista and 64 bit Java

Eclipse is an Integrated Development environment for programming languages such as Java, PHP and Python. It provides outlines and templates, helps you navigate complex file trees, and connects with code repositories.

First, install Python. Download the Windows X86-64 Installer from the download page and run the installer.

Next, install the Java SDK. I tried just installing the JRE, but this was unsuccessful.You can't just download the Java development kit (JDK) from the home page; you have to hunt around and find this page and then select Windows x64 from the dropdown.

When I installed the Java SDK the location of Java was not stored in the path. You will need to specify this to make sure it works. Open Control Panel, then System, then Advanced System Settings, then Environment Variables. Under the System variables scrolling window, scroll down to 'Path' and make sure the location of your Java engine is there. If not, add ;C:\Program Files (x86)\Java\jre6\bin to the end of the variable value. You can check that it's working by hitting the windows start button and typing 'cmd' in 'Start Search' (yes, Search). Type 'java' in the window that pops up and you should see some Java instructions.

While you're there make sure Python is also in the system path. Mine is ;C:\InstalledApps\Python26;. Note that I had to add both of these manually to the path; it was not automatic.

Then, install Eclipse. You can't just install the 64-bit available off the Eclipse.org home page, it won't work. Either it's not really 64 bit, or it's just incompatible, I don't know. What I do know is that PyDev will fail consistently (tested on multiple machines) with "Unable to create the selected preference page. org.python.pydev.plugin.preferences.PydevRootPrefs"

Download the 64-bit Eclipse from this page (which in turn links to the general Eclipse download page). There's no installation; just put it into a directory.

You can't just install PyDev and have it work. It won't successfully install its prerequisites. What you have to do is install Aptana plugin first (http://www.aptana.org/ first and then install pydev from there. Go here to the download page, then select 'Eclipse Plugin' from the left dropdown. This takes you to a download where you can copy this link: http://download.aptana.org/tools/studio/plugin/install/studio

Launch Eclipse. Select 'Help' then 'Install New Software' (yes, 'Install New Software' is under 'Help' - don't ask me why). Paste the URL you just copied into the 'work with' field and click add (you need to do this because the Aptana download location changed and this hasn't been reflected in the Eclipse list of sources). It will say 'pending' for a minute, then give you a list of things you can install.



Check 'Aptana Studio' and click 'Next'. Click next again, accept the license, and then click Finish ('Next' is greyed out). Then it will ask you whether you trust the certificates. Check the box beside the certificate, then click OK. Restart Eclipse. You may have to stop Windows Firewall from blocking parts of the program in order to continue.

Eclipse will open with the Aptana environment loaded. Click on the big Plugins icon, scroll down, and you'll see 'Aptana PyDev'. Click 'Get it'. Select 'PyDev for Eclipse' (don't select PyDev Mylin Integration; it is unable to load all its prerequisites, and you don't need it). Click Next, Finish, accept the license, etc. Restart Eclipse.

Next, open 'Window' -> 'Preferences' and select PyDev, then select 'Interpreter - Python' (you'll have to look for it).  Then click on 'Apply Defaults'. Then click 'AutoConfig'. It should locate the Python you installed in the first step. Click OK and OK again. Restart Eclipse.

You still won't see PyDev anywhere (though you'll see it as an option under 'new project').  Click on 'Window' -> 'Open Perspective' -> 'Other' and select 'Pydev'. It will open, and you'll see 'Pydev' added to your menus.

SVN

To finish setting up, you'll also want an SVN client plugin. Hit 'Help' - 'Install New Software'. Select 'all available sites' from the dropdown, and then select the 'collaboration' category (if they are grouped by category) and then select 'Subversive SVN team Provider' (you could also search for it by typing 'SVN' where it says 'type filter text'). Click next - next - accept the terms - finish. Check the box to trust the certificates, click OK, then restart Eclipse at the prompt.

You'll find SVN in the 'Wiundows'-'Perspectives'-'Others' display, just as you found PyDev. Select it. A window will popup with a bunch of kits, asking you to select an SVN connector. Just select the top one (most recent; for me it was 1.1.7). Next - next - accept - Finish. Restart Eclipse.

The SVN repository screen will show up. Click on the little green plus to add a remote SVN code repository. Type the URL in the field (you will need to find your own SVN repository; our repository requires credentials and is not (yet) public). You could try http://cogtool.hcii.cs.cmu.edu/svn - this one is open.

To actually obtain the code and work with it, you need to 'check it out'. Right-click on the repository URL and select 'check out'. This will download the code from the repository to your own system. You can also select 'synchronize' from the same menu to keep your local code up to date.





 

3 comments:

  1. Only someone who is completely addicted to Eclipse from their Java use or required to use it for work should try using Eclipse for Python programming.

    ReplyDelete
  2. Would you care to elaborate on that a bit Tom...?

    ReplyDelete

I welcome your comments - I'm really sorry about the moderation, but Google's filters are basically ineffective.