Software

This course is best followed if you can reproduce the examples and tutorials provided with it. To do so, you will need to install in your machine a series of software packages. These are all open-source and available for free to download.

There are two main pathways to install required Python libraries on your machine. A minimalist one is less stable and will only provide Python resources, while a more comprehensive one will install not only a Python stack but also several useful libraries (including some from the programminglanguage, R). If you want to learn to explore Python and its capabilities, while going beyond just this course, I recommend option 1. Option 2 is beneficial for this course but does not allow you to install new libraries, which means you are limited by what it offers (it is very powerful, so you will not be limited in any way).

The difference in these options is like buying as opposed to renting a house. If you own it, you might be able to expand it, paint the walls, add new furniture, even keep a dog. If you rent it, in most cases you will not be allowed to make any changes. A minimalist approach gives you everything you need and the freedom to build upon it. A comprehensive approach gives you everything too, but no freedom to experiment with new python libraries.

If you want a more minimalist installation that only includes the barebones (that can be extended) of what’s needed in this context, and/or you are not running Windows 10 Pro, macOS or Linux, the recommended approach is to do a conda installation. This route will install a Python distribution natively with the libraries we will need. Please note that no interactive extensions or R packages are installed in this case, and also be aware the installation is less stable as it relies on the specific versions for your OS and latest releases. In most cases, it should be fine, and this particular stack is regularly tested, but some failures nevertheless happen sometimes.

To install Python and required libraries through this approach, please follow these steps:

  • Install miniconda for your OS version from the official link. Make sure to install the Python 3 (e.g. 3.8) version, not Python 2.

To download Miniconda, follow these steps:

  1. Head over to the Download Page and select Python 3.8:
  1. We are using Python 3.8, so depending on which windows version you are using (32-bit or 64-bit), click on the relevant file in the Python 3.8 section (highlighted in red).
  2. This will download the Miniconda installation file. Depending on your setup and browser, you will need to select where to place it (the Desktop folder would be a good option) or it will go straight into a default location (e.g. the Downloads folder)
  • Once you have miniconda installed, we need to set up an independent environment that isolates all the functionality we need.

But first, what are environments and do you need them?

Environments in Python are like sandboxes that have different versions of Python and/or packages installed in them. You can create, export, list, remove, and update environments. Switching or moving between environments is called activating the environment. When you are done with an environment, you may deactivate it.

For this course, we want to have a bit more control on the packages that will be installed with the environment so we will create an environment with a so-called YAML file called install_gds_stack.yml.

Creating an environment from an environment.yml file

Open up a terminal as follows depending on your OS:

  • “Anaconda Command Prompt” in Windows
  • “Applications –> Utilities –> Terminal” in macOS
  • “ctr+alt+T” in Linux

Now run the following commands:

  • Get the installer file from here and unzip it.

  • Navigate to the folder where this file is (e.g. Downloads):

    cd /path/to/Downloads
    
  • Execute the following command (note you will need a good and stable internet connection and will take a while to complete):

    conda-env create -f install_gds_stack.yml
    

TIP:

Depending on the speed of your connection, this step will take a while (but no less than 15-20 minutes). Grab a cuppa and be patient!

  • This has created the gds environment, congratulations! We are almost there. Now we need to activate the environment. For this, run the following command:

    conda activate gds
    

    You should see the name of the environment at the start of your command prompt in parenthesis.

  • Verify that the new environment was installed correctly:

    conda list
    

    Note: This command will give you a list of the packages installed in this environment. For managing your environment or learning more about what environments are capable of, go to Manage conda environments.

  • Now we have to install the environment gds as a kernel on jupyter lab so you can use the packages inside it,

    ipython kernel install --name "gds" --user
    
  • Once the kernel is installed and environment is activated as we did above, we can open a jupyter lab instance using the following command,

    jupyter lab
    

2) A comprehensive approach: the GDS Docker container

If meet the following requirements, Docker is a stable alternative and works out of the box:

  1. You have admin rights over your machine
  2. You are running either Windows 10 Pro, macOS, or Linux distributions that are supported by Docker.

It provides a stable platform to run complex software setups like that required in this context. Docker is a containerisation technology that allows to run pre-packaged (containerised) software under controlled environments. Relying on Docker, the gds_env project provides a containerised platform for Geographic/Urban Data Science.

This resource provides step-by-step descriptions on how to install and run Python from your own computer for all operating systems.

MacOS Installation

Linux Installation

Windows

This resource is adapted from Arribas-Bel, Dani. 2019. gds_env: A Containerised Platform for Geographic Data Science (version 6.1). https://darribas.org/gds_env.