OSGeoLive and Python Introduction

OSGeoLive uses a version of Linux called Lubuntu. This has a very minimal desktop UI and light applications allowing it to run on minimal hardware.

Checking Versions

pip is a package manager for Python (the acronym may stand for “Pip Installs Packages”). Run the code below to see which version of Python are installed on OSGeoLive.


Compatibility with Python3 can be checked using: http://py3readiness.org/ Currently OSGeoLive is set up to use Python2. You can see which Python packages are available for download at https://pypi.org/ - the Python Package Index. There are many filtering and search options available e.g. https://pypi.org/search/?q=geospatial

Checking Installed Python Packages

pip list

Creating a Python Script

  • Open the text editor leafpad

  • Add some sample Python code e.g.

    import pyproj
    print("Hello Projected World!")
  • Save as test.py on the desktop - /home/user/Desktop/test.py

  • Test you can run it from the terminal using:

    python /home/user/Desktop/test.py

Installing a Python Editor

There are many choices for editing and running Python scripts, from text editors and the command line (see above), to feature-packed IDEs (Integrated Development Environments) such as PyCharm and Visual Studio.

For these sessions we will be using IDLE. This has been chosen for the following reasons:

  • It has a very simple UI with minimal functionality
  • It is available on Windows by default (and part of the ArcGIS installation), allowing familiarity between the two operating systems
  • It is easy to install on Lubuntu

To install simply run the following from the command line (note in Linux commands are typically case-sensitive). The yes flag avoids being manually prompted to accept installing IDLE.

sudo apt install --yes idle

Once installed IDLE will be available under the Programming menu on the start bar:


You can also now right-click on a Python script, and set IDLE to be the default application to use when double-clicking a file.