Summary and Schedule

Python is a general purpose programming language that is useful for writing scripts to work effectively and reproducibly with data.

Prerequisite

For Instructors

If you are teaching this lesson in a workshop, please see the Instructor notes.

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.

Setup


Prerequisite

Using Python in Jupyterhub

Python is a popular language for scientific computing, and great for general-purpose programming as well.

For this workshop, we will use a web-based Python Environment, JupyterHub, That UCSB Letters and Science IT has setup for us:

Use your UCSB NETID to sign into JupyterHub

If you prefer to use Python on your own computer, you may use the setup instructions below, but this is not required.

Regardless of how you choose to install it, please make sure you have Python installed to version 3.x (e.g., 3.10 is fine and will continue to receive security patches unitl 2026-OCT-04).

Required Python Libraries

The following packages are needed for this workshop:

  • Pandas
  • Jupyter notebook
  • Numpy
  • Matplotlib
  • Plotnine

All packages will have been automatically installed in the Jupyterhub Instance.

Discussion

Installing Pixi

Select your operating system from the options below.

  1. Open https://pixi.sh/latest/installation/ in your web browser.

  2. Under Installation, select Windows.

  3. Open the Command Prompt, paste the following command, and press Enter.

BASH

powershell -ExecutionPolicy ByPass -c "irm -useb https://pixi.sh/install.ps1 | iex"
  1. Close your Command Prompt window.
  1. Open https://pixi.sh/latest/installation/ in your web browser.

  2. Under Installation, select “Linux & macOS”.

  3. Open the Terminal, paste the following command, and press Return.

BASH

curl -fsSL https://pixi.sh/install.sh | sh

If your system doesn’t have curl, you can use wget:

BASH

wget -qO- https://pixi.sh/install.sh | sh
  1. Close your Terminal window.

Add Python and required libraries


Now that you’ve installed Pixi, we can install Python, JupyterLab, and the required libraries.

  1. Open your Terminal or Command Prompt. Move to your Desktop folder. There, create a new project with Pixi, which we’ll call python-intro

BASH

cd ~/Desktop
pixi init python-intro
  1. Move intro your project and add Python as a dependency of your Pixi project

BASH

cd python-intro
pixi add python
  1. Add also JupyterLab and the other required packages

BASH

cd python-intro
pixi add jupyterlab pandas numpy matplotlib

Launch a Jupyter notebook


After installation, in the Terminal or Command Prompt you have open, launch a Jupyter notebook by typing this command:

BASH

pixi run jupyter lab

The notebook should open automatically in your browser. If it does not or you wish to use a different browser, open this link: http://localhost:8888.

Prerequisite

Leave terminal used to launch Jupyter open

Jupyter depends on a server running in the background associated with the window used to launch it. Closing that window will results in web interface errors in the web interface. When done, you can either close the terminal or shut down the server using CTRL+C and submitting y within 5 seconds if the terminal is needed for other tasks.

For a brief introduction to Jupyter Notebooks, please consult our Introduction to Jupyter Notebooks page.