Hello, Visual Studio Code!

Example of VS Code IDE (from code.visualstudio.com/)

VS Code?

While the Jupyter Notebook environment is a great place to start coding, it is more typical to work on your code in an Integrated Development Environment (IDE) that offers more advanced options. Some people even have an almost religious association with their favourite IDE. Of the many available IDEs, Visual Studio Code (VS Code) from Microsoft has become one of the more popular ones. I actually use it to do most of my work, including writing code, writing notes in LaTeX, Markdown, and Quarto.

This chapter, which is optional, will help you set up VS Code. Although it is a bit of a pain to set up, it will make life a lot easier (for example, in locating files) in the long run. The installation process for VS Code involves first installing VS Code and then enabling extensions that tailor it to be used with Python and Jupyter Notebooks.

Installations

Setting up

Install VS Code

  1. Visit the official Visual Studio Code download page.
  2. Choose the correct version for your operating system (Windows, macOS, or Linux).
  3. Install using the default settings.

Enable Extensions

  1. Open VS Code.
  2. Click on the Extensions tab (or press Ctrl+Shift+X / Cmd+Shift+X).
  3. Search for “Python” and install the extension by Microsoft. Please do this first.
  4. Next, search for “Jupyter” and install that too (also by Microsoft).

Install ipykernel

You need a conda package called ipykernel to use Jupyter within VS Code. Let us install that next.

  1. Open VS Code.

  2. Open the terminal within VS Code (Ctrl+ or use the menu bar).

  3. Install the package by running:

    conda install -c conda-forge ipykernel

Select Python Interpreter

  • Click the top-right kernel selector (usually shown as “Python 3”).
  • Choose the interpreter from your conda environment (for example, miniconda3/envs/sp2273/bin/python).

Video Instructions

The following video guides you through the above process with a few differences (for example, Anaconda instead of Miniconda). But do take a look as it will help you getting started using the IDE for Jupyter Notebooks.

Adding the Learning Portfolio

I would recommend that you add the folder with your Learning Portfolio into VS Code. To do this, open the Explorer panel by clicking the first icon on the sidebar or pressing Ctrl+Shift+E (Cmd+Shift+E on macOS). Then right-click and pick Add Folder to Workspace, and use the GUI to locate your folder.