Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Setting up the Environment

Before you can run code for this tutorial, you need to set up your environment.

This section walks you through:

  1. Getting the tutorial code.
  2. Setting up your Python environment.
  3. Verifying everything is working.

Step 1: Clone the Tutorial Repository

Clone the code repository from GitHub:

git clone https://github.com/ALPHA-g-Experiment/ml-tutorial.git
cd ml-tutorial/code

Step 2: Set Up Your Python Environment

The easiest way to set up your environment is to install uv.

After installing uv, you can create and activate a virtual environment with the following commands:

uv venv --python 3.12
source .venv/bin/activate

Finally, install the required packages:

uv pip install -r requirements.txt

Step 3: Verify the Setup

To verify that everything is set up correctly, run the following command:

python -c "import torch; print(torch.__version__)"

If you see the version of PyTorch printed without any errors, your setup is successful.