Setup environment#

In this class, we provide coding examples and assignments via Jupyter notebooks. You can work on these notebooks either on the seminar server or on your own local installation.

Local Python installation#

We recommend installing Python using the open source package management system conda. It is free to download, open source, and easy to install on Windows, macOS and Linux. There is a free proprietary version called Anaconda, managed by a company of the same name, and an open-source version called Conda-Forge. In this course, we use the miniforge distribution from Conda-Forge.

With conda, you can create environments that have different versions of Python and packages installed in them. It is a good idea to create a new environment, even if you only plan to work in a single environment. Python packages can be quite picky regarding their dependencies with other Python packages. It is not uncommon to break a Python installation during an update. This way, you only need to re-create the environment, not the entire conda installation. Switching or moving between environments is called activating the environment. The commands below create a new conda environment geopy and then activate it.

conda create -n geopy
conda activate geopy

You can install the Python packages and their dependencies that we need for this course as follows:

conda install jupyter gdal geopandas scikit-learn scikit-image
conda install earthengine-api geemap seaborn seaborn-image

Alternatively, you can use a text file that lists the packages that you want to install. The command below creates a new environment and installs the packages listed in the text file.

conda create --name geopy --file


The miniforge distribution ships with mamba, which is faster and more reliable than the conda command. You can use the mamba command the same way you would use the conda command, i.e., simply replace conda with mamba in the commands above.

Jupyter notebooks#

Jupyter Notebook is a web-based interactive development environment (IDE) for creating notebook documents. Notebook documents (ending with .ipynb) can contain formatted text, code cells, and code outputs including plots and interactive graphics. As such they are ideal for presenting concepts and exercises in the classroom. There are several ways you can edit notebooks providing that jupyter packages are installed in your environment: 1) via the web-interface or 2) via desktop IDEs like PyCharm or Visual Studio Code. We recommend beginners to use the native web-interface, as it does not require any additional setup. You’ll find a shortcut on the desktop of the seminar servers. On your laptop you can start the web-interface from the conda terminal as follows:

conda activate geopy
jupyter notebook

Desktop IDEs#

Desktop IDEs provide more comprehensive tools for helping you writing code, e.g., more comprehensive code completion, multi-tasking, environment browsers, debugging, git integration. But you need to take some time to make yourself familiar with them. If you plan on sticking with Python, it is definitely worth checking them out. Both are free to use. PyCharm is probably the most popular free Python IDE and perhaps the most powerful. VS Code is a light-weight and versatile general purpose editor that can be customized to many different languages via extensions.