Infrastructure

The course does not use any university-specific resources. It is designed to run entirely on students’ machines using solely open-source software.

Communication

Students enrolled in the course at Charles University will be invited to a dedicated Discord server for online discussion. Students are encouraged to use the platform to seek help from peers, share thoughts and tips, and other meaningful contributions the rest of the group can benefit from. Learn from the mistakes of the others.

The tutor will be part of the discussion forum but the priority is to help each other, rather than seek guidance outside of class.

Code management and submissions

The course will be using GitHub Classroom. Each student will have their own code repository managed by the Classroom which will eventually contain all submissions. Part of the repository will be a definition of the software stack.

Software stack

There are many options on how to run Python. You may already have a copy on your machine, you can run it in the browser and install it in a myriad ways. This course uses what is considered a standard for scientific computing based on two key components - a package manager (you will be using Pixi) and an interface (Jupyter Lab).

The basics will be explained in the first lesson.

1. Install Pixi

The main tool dealing with the setup of the coding environment used in this course is Pixi. Go to Pixi website, and follow the installation instructions to install it on your machines.

2. Install Github Desktop

To manage the repositories and Git, the easiest option is to use GitHub Desktop. Get it installed.

3. Ensure you have a GitHub account

To use GitHub Classroom, you will need a GitHub account. Get one on github.com if you don’t have it already.

4. Accept the assignment in the GitHub Classroom

You have received a link with the invitation to accept the assignment. Click on it. You may need to authorise GitHub Classroom with GitHub.

5. Get the repository and install the environment

GitHub Classroom automatically created a repository you should be using during this course. The repository contains the definition of the environment and a placeholder structure for your work.

  1. Clone the repository to a location on your machine where you’d like to store the files for this course.
  2. Use Powershell or Terminal to navigate to the folder.
  3. Install the enviroment using pixi install.
  4. Start the Jupyter Lab interface using pixi run jupyter lab.

That is all!

Closing and reopening Jupyter Lab

The best way to close the Jupyter Lab and shut down its process running in the terminal is to use the Jupyter Lab’s interface. In the menu find File > Shut Down.

Shutting down Jupyter Lab

Next time, navigate to the folder and run pixi run jupyter lab again.

If you prefer to use conda over Pixi, you can follow the instructions below.

Anaconda and the other snakes

If you have Anaconda, conda, or mamba installed, use that directly. Just start Anaconda Prompt (or any other relevant prompt) or Terminal and start with the point Create a Python environment.

Caution

Windows may complain that the app is not recognised. Click More information and you will be able to run the installer.

  1. Download miniconda package manager from Anaconda for your operating system.
  2. Execute the installer and make sure to create start menu shortcuts (there’s a tick box during installation).
  3. Open the installed Anaconda Prompt application.
  4. Configure conda to avoid automatic activation of the base environment. You should never use it to avoid issues in the future.
conda config --set auto_activate_base false
  1. Create a Python environment using the following command:
conda env create -f https://martinfleischmann.net/sds/environment.yml
  1. Activate the environment using:
conda activate sds
  1. Start JupyterLab interface:
jupyter lab
Important

Ensure that you install miniconda in a directory without any special characters in the name. It may occasionally break things.

  1. Download miniconda package manager from Anaconda for your operating system and install it.
  2. Open Terminal application.
  3. Configure conda to avoid automatic activation of the base environment. You should never use it to avoid issues in the future.
conda config --set auto_activate_base false
  1. Create a Python environment using the following command:
conda env create -f https://martinfleischmann.net/sds/environment.yml
  1. Activate the environment using:
conda activate sds
  1. Start JupyterLab interface:
jupyter lab

A Jupyter Lab interface will show up in your browser. If it hasn’t opened automatically, copy the link printed in your command line/terminal.

Closing Jupyter Lab

The best way to close the Jupyter Lab and shut down its process running in the terminal is to use the Jupyter Lab’s interface. In the menu find File > Shut Down.

Shutting down Jupyter Lab

Opening Jupyter Lab next time

The steps above are needed only the first time. Once you create the environment, it won’t disappear and you can use it until you don’t delete it. Once you close Jupyter Lab session, you can always start a new one:

  1. Open Anaconda Prompt
  2. Activate the environment:
conda activate sds
  1. Start JupyterLab interface:
jupyter lab
  1. Open Terminal
  2. Activate the environment:
conda activate sds
  1. Start JupyterLab interface:
jupyter lab
Always activate an environment

You should never use conda install in the base environment. Remember to always activate the environment.

Plan B with Google Colab

If you are unable to install an environment using the instructions above, you can follow the course using Google Colab. You will just need to install the required packages to your Colab environment. Reach out in class or via Discord if you need to set it up.

Troubleshooting

In case of any issues related to environment creation, reach out in the class or via Discord.