Working on your own machine

Setup & tools

Colab works for online practice, but does not test your laptop. Prepare and run the readiness check well before exam day. The exam is written on your own laptop, in VS Code, with no internet, and that should not be the first time you use it. Session 3 walked through the four steps below; have them done well before the exam.

needed you will use it on this course  ·  extra good to know, not required

The four steps needed

Do them in order. Each link is the official guide, not a blog post that may have rotted.

  1. Install Python 3.14. Take the newest 3.14 release, not 3.15: Python 3.15 came out on 1 October 2026, and the package versions this course uses have no installer for it yet. Python 3.12 and 3.13 work too. On Windows, choose the 64-bit Windows installer and tick Add python.exe to PATH: it is easy to miss and awkward to fix later. python.org: the newest Python 3.14
  2. Install VS Code. The editor itself. It is not Python, and installing one does not install the other. code.visualstudio.com/download
  3. Add the Python extension. This is what teaches the editor about Python: running code, completing names, showing documentation when you hover. VS Code Python tutorial · then notebooks in VS Code
  4. Install the packages. Open a new notebook and run this in a cell:
    %pip install -r https://theill95.github.io/mlfin-2026/requirements.txt
    It installs the versions every notebook, lecture and mock exam was checked with (NumPy 2.3, pandas 2.3, matplotlib 3.10, scikit-learn 1.7, XGBoost 2.1.4 and LightGBM 4.6), so your numbers match the ones in the materials. For an existing setup, run the readiness check first. Use this install command while online only if packages are missing or their versions differ; it replaces other versions. From a terminal, python -m pip install -r with the same address installs into that Python. Then run the readiness check. Mac users whose checks fail should follow the matching repair below.
If a step fails, bring the error message. Not a description of it, the text itself. Nearly every setup problem is solved in a minute by someone who can read the actual message, and unsolvable by guessing.

Local readiness check

Use this check when setting up a laptop or preparing for offline work. Download the readiness notebook, or get it with the course ZIP. Keep it beside the data/ folder.

  1. Open the course folder in local VS Code and select the Python kernel you intend to use.
  2. Disconnect from the internet, restart the kernel and select Run All.
  3. Read the final verdict and confirm that the plot appears. A stopped run or kernel crash is not a pass.

The check fits and predicts with the course models, including XGBoost and LightGBM. A Colab run does not test your laptop. If something fails, follow the matching repair below, then restart the kernel and repeat the full check offline.

XGBoost and LightGBM: installation and troubleshooting

Run the readiness notebook locally in VS Code with your selected local kernel and internet off. It tests actual XGBoost and LightGBM model fitting and prediction, not just their installed versions. If all checks pass, no additional installation is needed.

macOS: libomp.dylib is not loaded or not found

The Python packages can be installed while the separate OpenMP runtime is missing. Reconnect to the internet and:

  1. If needed, install Homebrew from its official site. Follow the installer's Next steps, including the PATH setup.
  2. In macOS Terminal (not a Python notebook cell), run:
    brew install libomp
  3. Restart the notebook kernel, disconnect from the internet and Run All again.

If brew is not found, finish Homebrew's Next steps and reopen Terminal. Do not use pip install libomp. If Homebrew says the library is already installed and the error persists, keep the full error and ask for help.

Other errors need different fixes

  • Missing Python package or wrong version: while online, run the course %pip command above in the selected local kernel, then restart it. The course pins XGBoost 2.1.4 and LightGBM 4.6; do not blindly upgrade them.
  • Incompatible architecture: Python and native libraries must match. On Apple Silicon, prefer native arm64 Python and Homebrew rather than mixing Intel/Rosetta Python with ARM libraries. The notebook prints your Python path and architecture to help diagnose this. Ask for help before replacing environments.
  • Existing Conda environment: if it passes, keep it. If it fails, get help repairing that environment rather than mixing package managers.

After every repair, restart the kernel and repeat the full check offline. If it still fails or the kernel crashes, send the full error and printed environment details to jobo@econ.au.dk.

Official references: LightGBM 4.6 installation, XGBoost 2.1.4 runtime guidance, Homebrew installation.

Python, VS Code, and the extension are three things needed

The commonest week-one confusion is thinking VS Code is Python. It is not. Python is the language: the thing that actually runs your code. VS Code is the editor: where you type and read it. The Python extension is the bridge between them. Three separate installs that then work together.

Which Python is it using? needed

A machine can have several Pythons on it, and VS Code has to be told which one to use. The first time you open a notebook it will ask, and it remembers the answer. You can change it later from the kernel picker at the top right of the notebook, or with Ctrl+Shift+P then "Python: Select Interpreter".

Almost every "but I installed it!" problem is this: the package went into one Python and VS Code is running a different one. Using %pip install from inside the notebook avoids it entirely, because %pip installs into whichever Python that notebook is actually using.

Where your data file has to sit needed

Locally, a data file sits next to your code:

mlfin/
├── analysis.ipynb
└── data/
    └── prices.csv

Then pd.read_csv("data/prices.csv") finds it. That path is read relative to where you are running from, not relative to where the file lives, which is why the fix for FileNotFoundError is almost always the same: in VS Code, open the folder (File → Open Folder), not just the single file.

The course notebooks are more forgiving than that. They look in a few likely places and, failing all of them, download the data from this repository. So they work in Colab with nothing uploaded, and locally with the data/ folder beside them.

When something breaks needed

What you seeWhat it meansWhat to do
Mac: libomp.dylib not loaded / not found, or incompatible architecture A native library is missing or does not match your Python architecture. Use the matching Mac repair instructions, then restart the kernel and repeat the readiness check offline.
ModuleNotFoundError: No module named 'pandas' Python looked for the package and it is not there. Run %pip install pandas in a cell. If it was already installed, you are running a different Python: check the interpreter.
ModuleNotFoundError: No module named 'sklearn' scikit-learn installs as scikit-learn and imports as sklearn; %pip install sklearn fails on purpose. Run the install line from step 4, which spells it right.
The install line says it is building pandas or scikit-learn, then fails with a long error Your Python is 3.15, and the course's versions have no installer for it yet, so pip tries to compile them and cannot. Install Python 3.14 as well (step 1), pick it as the notebook's kernel, and run the install line again.
Your number differs from the one in a notebook, from the third decimal on Other package versions: a few results move a little between versions. Run the install line from step 4. In Colab, Session 12's notebooks install the XGBoost they need by themselves.
FileNotFoundError: 'data/prices.csv' The path is right or wrong relative to where you are running, and you are not where you think you are. Open the folder rather than the file. import os; os.getcwd() tells you where you actually are.
No kernel, or "select a kernel" and nothing sensible listed VS Code cannot find a Python to run the notebook with. Check Python installed correctly, then pick it from the kernel list. You may need %pip install jupyter once.
NameError: name 'prices' is not defined The cell that creates prices has not run in this session. Run the cells above, or Run All. Notebooks remember what you ran, not what is written above.
SettingWithCopyWarning pandas cannot tell whether you meant to change a selection or the original table. Add .copy() when you take the selection you are about to modify.
A cell runs forever Usually a while loop whose condition never becomes false. Press the stop button, then check that something inside the loop actually changes what the condition tests.

Scripts and notebooks: .py against .ipynb extra

This course lives in notebooks, and so does the exam, so you do not need scripts. But you will meet them, and the difference is worth a minute.

A notebook, .ipynbA script, .py
How it runsOne cell at a time, in whatever order you press RunTop to bottom, every time
OutputSits under each cell, and is saved in the filePrinted to a terminal, and gone
Good forExploring, and for anything with figures or a written argumentWork you will repeat, and code other files will import
WeaknessHidden state: what you ran can differ from what is writtenNo inline output, so exploring is clumsy

A common working pattern is to explore in a notebook, and move anything you have stopped changing into a .py file you can import. Both open in VS Code with no extra setup.

Virtual environments extra

You will read about these. The idea: instead of one shared set of packages for your whole machine, each project gets its own. That way upgrading a package for one project cannot quietly break another, and you can record exactly which versions a project needs.

For this course you do not need one. One Python with the course's packages installed is completely fine. If your setup created a .venv folder, that is what it was: select it as your interpreter and carry on.

If you want to understand them: Python environments in VS Code.

What pip actually does extra

Python ships with a standard library: modules like math, random and statistics that are always there. Everything else lives on PyPI, a public archive of Python packages. pip is the program that fetches a package from PyPI and installs it into your Python, along with anything that package itself depends on.

So %pip install pandas is a download, once. import pandas is what makes it available in a particular notebook, every time. Installing packages is the official explanation.

VS Code, once it is working extra

Git and GitHub extra

Not used on this course, and not needed for the exam. Worth knowing about anyway, because it is how essentially all code is kept: a full history of every change, the ability to go back to any earlier version, and a way for several people to work on the same files without overwriting each other. This site and all its materials live in a Git repository.

If you are curious: GitHub's own introduction and git-scm.com. VS Code has Git support built in, so you would not need a separate program.