Introduction
To run the python scripts for importing, plotting and modelling OSSL data as described in other posts of this blog you need to have a python development environment. This post describes how to setup a python environment using Eclipse. The instructions are shorthand and written using MacOS. I have also published more detailed instructions for setting up Eclipse for MacOS and a summary for how to install Eclipse and Anaconda in Ubuntu20.
Eclipse
Eclipse is “an open extensible IDE for anything and nothing in particular”, where IDE stands for Integrated Development Environment. We will use Eclipse for testing and developing the python scripts used for processing OSSL data.
Open a browser and go to Eclipse foundation. Look for the (orange) button. You should come directly to the download page for your OS. At time of writing this in September 2023 the latest version of Eclipse is 2023-06. Select the version that is appropriate for your machine architecture and go ahead and download (figure 1).
The later versions of the Eclipse installations packages are all inclusive. The installation package is rather small and should download quickly (figure 2).
Open the installation app that was downloaded and run it - the example to the right shows the MacOS Eclipse installation app icon. Just double click and the installation of Eclipse itself should start.
It might take a while for the installer to get going (figure 3).
When presented with different alternatives to install, chose the Eclipse IDE for Java Developers alternative.
After selecting the installation version, the next window will summarise your choice and the destination paths of your installation (figure 5).
Click Eclipse installation (figure 6).
. When the installation is ready, the Eclipse installer window changes and you can launch (or inspect) theThe first time you start, Eclipse will ask you to Select a directory as workspace. You can usually accept the default, but as I have older versions installed I set a specific workspace for each version as shown in figure 7.
Once you have selected the directory for the workbench, the next window is the Welcome to the Eclipse IDE for ... Before proceeding you have to Launch the Eclipse Marketplace (figure 8).
In the Eclipse Marketplace window, enter the search term pydev in the Find field and click the
button in the top row. The top result should then be the PyDev extension (figure 9). Click the button for the PyDev extension.In the sequence of windows that follows (figures 10 to 13) you must confirm, bypass and accept various conditions to follow the installation through.
Once the PyDev extension is installed, Eclipse needs to be restarted for the installation to be activated. In the window asking if you want to restart click the button (figure 14).
Once has restarted you will again come to the Welcome to the Eclipse IDE for .. window. This time you just bypass (hide) the Welcome window by clicking the little hide icon in the upper right corner (shown to the right).
An Eclipse project window opens (figure 15).
To continue you must have cloned or downloaded the python OSSL package from GitHub as explained in a previous post.
To import the python OSSL package, either click Import projects in the Package Explorer tab (the left main column), or go via the menu:
In the Import window, expand the General folder and then select Projects from Folder or Archive as shown in figure 16.
This should hihglight the (blue) clone/download of the OSSL-pydev repo. Under that path, select the folder ossl-xspectre (the folder that is also contains the hidden Eclipse files .project and .pydevproject) (figure 17).
button, click it to proceed. In the next, Import Projects window, select the (white) button (figure 17) and navigate to the path where you saved theClick Eclipse is asking for is the virtual environment that you created in the previous post.
. You should then get an error message “Python not configured” (figure 18). WhatIn the Python not configured window, click the (blue) button
. In the Preferences window that opens, click the button at the top of the right column and select the alternative Browse for python/pypy exe (figure 19).Navigate to the virtual Python environment you created with Anaconda. It is under the Anaconda installation directory, in a subfolder called envs. Under envs you should have another subfolder with the name of the environment you created (e.g. “ossl_py38” if you used the suggested name in the post on Anaconda). The python/pyp exe file is under the bin folder and called python3.8. The relative path under your Anaconda installation should thus be:
In my system (MacOS) it looks like this when I have selected the python3.8 exe file (figure 20).
Click
, then click again in the Selection needed window (figure 21)You should then get back to the Preferences window. Click
.Finally you get back to Eclipse project window. In the left column package explorer you should see the pydev package ossl-xspectre. Expand to see the content by clicking on it, this will first cause a popup window asking for your Default Preferences for PyDev in Eclipse. Accepting the defaults by clicking is recommended.
To run the scripts (python modules) go to the next post that explains how to link the script to OSSL data and edit the command files required.