Lesson 0: Configuring your computer for the bootcamp


Why Python?

There are plenty of programming languages that are widely used in data science and in scientific computing more generally. Some of these, in addition to Python, are Matlab/Octave, Mathematica, R, Julia, Java, JavaScript, Rust, and C++.

I have chosen to use Python. I believe language wars are counterproductive and welcome anyone to port the code we use to any language of their choice, I nonetheless feel we should explain this choice.

Python is a flexible programming language that is widely used in many applications. This is in contrast to more domain-specific languages like R and Julia. It is easily extendable, which is in many ways responsible for its breadth of use. We find that there is a decent Python-based tool for many applications we can dream up, certainly in data science. However, the Python-based tool is often not the very best for the particular task at hand, but it is almost always pretty good. Thus, knowing Python is like having a Swiss Army knife; you can wield it to effectively accomplish myriad tasks. Finally, we also find that it has a shallow learning curve with most students.

Perhaps most importantly, specifically for neuroscience applications, is that Python is widely used in machine learning and AI. The development of packages like TensorFlow, PyTorch, JAX, Keras, and scikit-learn have led to very widespread adoption of Python.

Jupyter notebooks

The materials of this course are constructed from Jupyter notebooks. To quote Jupyter’s documentation,

Jupyter Notebook and its flexible interface extends the notebook beyond code to visualization, multimedia, collaboration, and more. In addition to running your code, it stores code and output, together with markdown notes, in an editable document called a notebook.

This allows for executable documents that have code, but also richly formatted text and graphics, enabling the reader to interact with the material as they read it.

Specifically, notebooks are comprised of cells, where each cell contains either executable Python code or text.

While you read the materials, you can read the HTML-rendered versions of the notebooks. To execute (and even edit!) code in the notebooks, you will need to run them. There are many options available to run Jupyter notebooks. Here are a few we have found useful.

  • JupyterLab: This is a browser-based interface to Jupyter notebooks and more (including a terminal application, text editor, file manager, etc.). As of March 2025, Chrome, Firefox, Safari, and Edge are supported.

  • VSCode: This is an excellent source code editor that supports Jupyter notebooks. Be sure to read the documentation on how to use Jupyter notebooks in VSCode. This may be an especially good option for Windows users.

  • Google Colab: Google offers this service to run notebooks in the cloud on their machines. There are a few caveats, though. First, not all packages and updates are available in Colab. Furthermore, not all interactivity that will work natively in Jupyter notebooks works with Colab. If a notebook sits idle for too long, you will be disconnected from Colab. Finally, there is a limit to resources that are available for free, and as of March 2025, that limit is unpublished and can vary. All of the notebooks in the HTML rendering of this book have an “Open in Colab” button at the upper right that allows you to launch the notebook in Colab. This is a quick-and-easy way to execute the book’s contents.

For our work in this programming bootcamp, I encourage you to use either JupyterLab in the browser or VSCode, with Colab as a backup if you’re having trouble.

Marimo

Marimo offers a very nice notebook interface that is a departure from Jupyter notebooks in its structure. The biggest departure is that Marimo notebooks are specifically for Python, as opposed to being language agnostic like Jupyter. As a result, Marimo notebooks can offer many features not seen in Jupyter notebooks (without add-ons). The two most compelling, at least to me, are

  • Marimo notebooks are simple .py files which allow for easier version control and simple execution as scripts.

  • Marimo notebooks are reactive, meaning that the ordering of the cells is irrelevant and the notebook runs all cells that need to be rerun as a result of a change of value of a variable in any given cell.

In the course, we will use Jupyter notebooks, but you are welcome to play with Marimo notebooks. Upon completing the installation instructions in this notebook, Marimo will be installed.

Installing Git

We will be discussing version control with Git in this course. Git is already installed is you are using a Mac and most flavors of Linux. If you are using Windows, you need to install it. You can do this by following the instructions here.

Obtaining the bootcamp materials

Prior to the bootcamp, download the course materials. Upon unzipping, you will have a directory called bootcamp-main/. You can leave it with this name, or rename it to bootcamp/. Throughout the bootcamp, I will assume you have the materials stored in a directory called ~/git/bootcamp/, where ~ is shorthand for your home directory. If you want to have that structure, you can create a directory called git/ in your home directory, move the bootcamp-main/ folder into ~/git/ and then rename the folder bootcamp/. That is not necessary, though, and you make keep the materials wherever you wish on your machine, but make sure you know where you have everything stored.

Installing Python tools

Prior to embarking on your journey into data analysis, you need to have a functioning Python distribution installed on your computer. We will use pixi, a relatively new package manager that I have found very effective.

Importantly, it does so in a project-based way. That is, for each project, you use Pixi to create and manage the packages needed for that project. Our “project” here is our introduction to programming course.

Step 1: Install Pixi. To install Pixi, you need access to the command line. For macOS users, hit Command-space, type in “terminal” and open the Terminal app. In Windows, open PowerShell by opening the Start Menu, typing “PowerShell” in the search bar, and selecting “Windows PowerShell.” I assume you know how to get access to the command line if you are using Linux.

On the command line, do the following.

macOS or Linux

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

Windows

powershell -ExecutionPolicy ByPass -c "irm -useb https://pixi.sh/install.ps1 | iex"

Step 2 Navigate to the directory where you store the bootcamp materials using the command line. For example, if the directory is ~/git/bootcamp/ and you are in your home directory, you can do

cd git/bootcamp

on the command line.

Step 3 Install! Do the following on the command line.

pixi install

Step 4 To be able to use all of the packages, you need to invoke a Pixi shell. To do so, execute the following on the command line.

pixi shell

You are now good to go! After you are done working, to exit the Pixi shell, hit Control-D.

For doing work for this bootcamp, you will need to cd into the directory you created in step 2 and execute ``pixi shell`` every time you open a new terminal (or PowerShell) window.

Installation of the Arduino IDE

In an auxiliary lesson (not covered during the bootcamp, but you can work through it yourself), we will use an Arduino Uno board as we learn to control external devices. To enable us to program and use the device, you should download and install the Arduino IDE, available here: https://www.arduino.cc/en/software.

Launching JupyterLab

Once you have invoked a Pixi shell, you can launch JupyterLab via your operating system’s terminal program (Terminal on macOS and PowerShell on Windows). To do so, enter the following on the command line (after having run pixi shell).

jupyter lab

You will have an instance of JupyterLab running in your default browser. If you want to specify the browser, you can, for example, type

jupyter lab --browser=firefox

on the command line.

Alternatively, if you are using VSCode, you can use its menu system to open .ipynb files. Make sure you select the Python kernel corresponding to your environment. You can read the documentation here. Hint: You may need to restart VSCode after doing the above installations so it is aware of your pixi environment.

Checking your distribution

Let’s now run a quick test to make sure things are working properly. We will make a quick plot that requires some of the scientific libraries we will use.

Launch a Jupyter notebook in JupyterLab. In the first cell (the box next to the [ ]: prompt), paste the code below. To run the code, press Shift+Enter while the cursor is active inside the cell. You should see a plot that looks like the one below. If you do, you have a functioning Python environment for scientific computing!

[1]:
import numpy as np
import bokeh.plotting
import bokeh.io

bokeh.io.output_notebook()

# Generate plotting values
t = np.linspace(0, 2*np.pi, 200)
x = 16 * np.sin(t)**3
y = 13 * np.cos(t) - 5 * np.cos(2*t) - 2 * np.cos(3*t) - np.cos(4*t)

p = bokeh.plotting.figure(height=250, width=275)
p.line(x, y, color='red', line_width=3)
text = bokeh.models.Label(x=0, y=0, text='WIS bootcamp', text_align='center')
p.add_layout(text)

bokeh.io.show(p)
Loading BokehJS ...

Computing environment

[2]:
%load_ext watermark
%watermark -v -p numpy,bokeh,jupyterlab
Python implementation: CPython
Python version       : 3.13.5
IPython version      : 9.4.0

numpy     : 2.2.6
bokeh     : 3.7.3
jupyterlab: 4.4.5