Using DTS Eclipse, PyDev, and Python 2.7

Red Hat intended for developers to integrate Developer Toolset 2.0 (DTS) and Red Hat Software Collections 1.0 (RHSCL). As you may not realize, inside the DTS is a copy of Eclipse and you can use that with any software collection. In other words, you can use PyDev, with the Python 2.7 Software Collection from RHSCL in the Eclipse from DTS. Let’s find out how.

First, let’s make sure you have the right repos,

[lwhite@lwhite-laptop ~]$ sudo yum repolist
Loaded plugins: product-id, security, subscription-manager
This system is receiving updates from Red Hat Subscription Management.

rhel-server-dts2-6-rpms                                                                                             | 2.8 kB    00:00
rhel-server-rhscl-6-rpms                                                                                            | 2.8 kB     00:00

repo id                             repo name                                                                                        status

rhel-server-dts2-6-rpms             Red Hat Developer Toolset 2 RPMs for Red Hat Enterprise Linux 6 Server                              235
rhel-server-rhscl-6-rpms            Red Hat Software Collections RPMs for Red Hat Enterprise Linux 6 Server                             440

repolist: 32,446

If not, add the channel (using rhn commands) or the repo (using yum), here is yum:

sudo yum-config-manager --enable rhel-server-dts2-6-rpms
sudo yum-config-manager --enable rhel-server-rhscl-6-rpms

Ok, once you have those, we need to install Eclipse and Python.

sudo yum install devtoolset-2-eclipse python27

Now we need to get PyDev, first step of which is getting the certificate and installing it. However, note, if you are using the alternatives system in RHEL, you don’t need to start Eclipse and find java_home, you can use the alternatives keytool directly. If you are not, you can just run eclipse with “scl enable devtoolset-2 eclipse”.
Here is what worked on my machine, YMMV. See PyDev Install for more ideas.

[lwhite@lwhite-laptop ~]$ cd /tmp
[lwhite@lwhite-laptop tmp]$ wget
[lwhite@lwhite-laptop tmp]$ keytool -import -file /tmp/pydev_certificate.cer
Enter keystore password:
Owner: CN=Brainwy Software, OU=PyDev, O=Brainwy, L=Florianopolis, ST=SC, C=Brazil

Trust this certificate? [no]:  yes
Certificate was added to keystore

After the certificate is installed, you can now actually run eclipse and install the plugin the “normal” way.

scl enable devtoolset-2 python27 eclipse

Go to “Help | Install New Software…” Add the update site.
Screenshot: Add Repository
Skipping many “next” buttons and “confirms” (if you want a step by step, check out the PyDev Install).

When you get to the restart step, you may want to say “no,” then exit, and restart with the scl enable command. We will make this easier later.

We need to setup the interpreter now, so startup Eclipse again. Then, go to “Window | Preferences”, Then “PyDev | Interpreter – Python” and then click on “New…” (“Auto Config” may not work). Once there, give it an appropriate name then browse to the interpreter installed by SCL Python27 (“/opt/rh/python27/root/usr/bin/python”).

Screenshot: Select interpreter

OK, now once you hit OK, you need to select all of the libraries (Eclipse may just figure it out). See below:

Screenshot: Selection needed

Now, click OK/Confirm/What-have-you, until you get out of Preferences and everything should be set.

To make things easier you can create an alias and maybe add it to your .bashrc, try

alias eclipse-python="scl enable devtoolset-2 python27 eclipse"

Leave a Reply