Wednesday, January 30, 2013

Installing Eclipse/PyDev on Ubuntu 12.04

I was sent to Groovy on Grails training this week for work and we are using the Eclipse powered Groovy Grails Tool Suite.   So it had me thinking, I have been using gEdit for writing all of my Python code up until now.  It has been one of my goals to get familiar with Eclipse, is there something similar for Python?  I looked and PyDev fits the bill.  

Here is a step by step on how I installed Eclipse/PyDev on Ubuntu.  The first thing I did was install Eclipse through the Ubuntu software center, it comes right up with a search.  After it finished downloading and installing I tried launching it and immediately had an error.  This error told me to look at the log file:

/home/rsnyder/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/1359586660119.log

That log file contained:

!ENTRY org.eclipse.osgi 4 0 2013-01-30 17:57:40.822
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
        no swt-gtk-3740 in java.library.path
        no swt-gtk in java.library.path
        Can't load library: /home/rsnyder/.swt/lib/linux/x86_64/libswt-gtk-3740.so
        Can't load library: /home/rsnyder/.swt/lib/linux/x86_64/libswt-gtk.so

It appears the SWT libraries moved and Eclipse couldn't find them.  To fix this you can make a symbolic link to the new location:

ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86/
ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/
After making the symbolic link Eclipse now launches fine. Now onto installing PyDev.

1. Launch Eclipse.  Open the Help tab and click Install New Software
2. Click the Add button on the top right.
3. Enter the name and url:

Name:  PyDev 
URL:   http://pydev.org/updates



4. After entering the name and url hit OK. On the next screen only check the PyDev box and then click next.



5.  Click Next again, accept the license agreement and click Finish.  I had to accept the certificates for PyDev and then restart Eclipse.  

6.  Once Eclipse starts back up Go to Windows tab, Preferences and Open up the PyDev menu.  Choose the Python Interpreter like below.


7.  Click Auto Config and another window will open for the SYSTEMPATH.  Choose Select All and then OK.


8.  You will be taken back to the previous screen and now click Apply and then OK.    You should now have PyDev working on Eclipse. 

2 comments: