Setup VS Code

This tutorial guides you through the installation and configuration of Visual Studio Code (VS Code) for Python development in the 0013 computer room at the University of Geneva.

Open VS Code

  1. Create a folder on your H:/ drive named data_science
  2. Open VS Code
  3. Click File / Open Folder and choose the data_science folder (Figure 1)
  4. When asked, click to confirm your trust in the system

These steps will ensure that Python works and finds the files in this exact folder.

Figure 1: Open VS Code and set the working folder

Create a new Jupyter Notebook

  1. Type Ctrl + Shift + p (or Cmd + Shift + p on MacOS) to open the command palette
  2. Type jupyter and select Create: New Jupyter Notebook (Figure 2)
Figure 2: Create a new Jupyter Notebook
Command palette

The command palette is a key functionality of VS Code, learning to use it will speed up your workflow.

Install the Python extensions

This step installs the Python extensions for VS Code.

  1. When asked, click the Install button and wait for it to finish (Figure 3)
Figure 3: Create a new Jupyter Notebook

Install Jupyter

Jupyter Notebooks are one of the ways to run Python. This step installs all the required Jupyter stuff for VS Code.

  1. On the top right corner of the notebook, locate and click on the Select kernel button Figure 4
  2. Install the Jupyter notebook support extension (Figure 5)
Figure 4: Browse for kernels
Figure 5: Install the Jupyter notebook support extension

Select the right Python

Several versions of Python can be installed on a computer. In the computer room, these versions are controlled by an environment manager called anaconda. This step ensures that the Jupyter notebook will use the right Python version, i.e., the one installed using anaconda.

  1. On the top right corner of the notebook, where the Select kernel button previously appeared, make sure you see base (Python 3.x.x) (Figure 6)
  2. If you don’t, click on the button and search for the right one (i.e., there should be anaconda in the path)
Figure 6: Select the right Python environment

Open the course material in VS Code

  1. Type Ctrl + Shift + p (or Cmd + Shift + p on MacOS) to open the command palette
  2. Type simple and select Simple Browser: Show
  3. Enter https://e5k.github.io/Data-Science/
  4. Click the Simple Browser tab and move it to the right of VS Code to open the course material alongside your Jupyter Notebook