# Configuring VS Code for Jupyter Development with the AI-For-Beginners Curriculum

> Set up VS Code for Jupyter development with the AI-For-Beginners curriculum. Create the Conda environment, activate it, and enjoy automatic kernel detection for full notebook support in VS Code.

- Repository: [Microsoft/AI-For-Beginners](https://github.com/microsoft/AI-For-Beginners)
- Tags: how-to-guide
- Published: 2026-08-05

---

**You can configure VS Code for Jupyter development with the Microsoft AI-For-Beginners curriculum by creating the Conda environment from [`.devcontainer/environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/.devcontainer/environment.yml), activating it, and opening the repository in VS Code, where the Python extension automatically detects the kernel and provides full notebook support.**

The **microsoft/AI-For-Beginners** repository is a comprehensive educational curriculum that combines executable Jupyter notebooks, containerized development environments, and interactive quizzes. Configuring VS Code for Jupyter development with this curriculum ensures you have IntelliSense, variable exploration, and seamless cell execution while working through the 24 lessons covering PyTorch and TensorFlow implementations. The repository structures its content in the `lessons/` directory, with setup instructions documented in [`lessons/0-course-setup/how-to-run.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/0-course-setup/how-to-run.md) and dependencies locked in [`.devcontainer/environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/.devcontainer/environment.yml).

## Setting Up the Conda Environment

Before opening VS Code, you must create the isolated Python environment that contains all required libraries. The repository provides a complete **Conda environment definition** in [`.devcontainer/environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/.devcontainer/environment.yml) that pins versions for NumPy, Matplotlib, OpenCV, PyTorch, and TensorFlow.

Run the following commands from the repository root:

```bash

# Clone the curriculum

git clone https://github.com/microsoft/AI-For-Beginners.git
cd AI-For-Beginners

# Create and activate the environment

conda env create -f .devcontainer/environment.yml
conda activate ai4beg

```

The environment name `ai4beg` is defined in the YAML file. Once activated, this environment provides the exact Python interpreter that VS Code will use for its Jupyter kernel.

## Configuring VS Code Workspace Settings

After activating the environment, launch VS Code from the terminal so it inherits the correct environment variables:

```bash
code .

```

The **Python extension** for VS Code automatically detects the Conda environment and offers to select it as the default interpreter. For explicit control over which Python binary VS Code uses for Jupyter execution, create a workspace settings file at [`.vscode/settings.json`](https://github.com/microsoft/AI-For-Beginners/blob/main/.vscode/settings.json):

```json
{
  "python.pythonPath": "/opt/conda/envs/ai4beg/bin/python",
  "jupyter.notebookFileRoot": "${workspaceFolder}"
}

```

This configuration ensures that every notebook you open in `lessons/` executes against the `ai4beg` environment rather than your global Python installation.

## Working with Jupyter Notebooks

The curriculum stores executable content in the `lessons/` directory, with each lesson containing a README and one or more `*.ipynb` files. For example, the Perceptron lesson lives at `lessons/3-NeuralNetworks/03-Perceptron/Perceptron.ipynb`.

When you open any notebook in VS Code:

- **Cell execution** runs against the selected `ai4beg` kernel
- **Variable explorer** and **data viewer** appear in the side panel
- **IntelliSense** provides autocomplete for PyTorch and TensorFlow APIs

You can also execute notebooks headlessly from the terminal for validation:

```bash
jupyter nbconvert --to notebook --execute lessons/3-NeuralNetworks/03-Perceptron/Perceptron.ipynb --output Perceptron-out.ipynb

```

## Container-Based Development

If you prefer an isolated Docker environment over a local Conda installation, VS Code supports the hidden **`.devcontainer`** folder included in the repository. When VS Code detects this folder, it prompts you to "Reopen in Container," which automatically:

1. Builds a Docker image using the definition in `.devcontainer/`
2. Installs the [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) dependencies inside the container
3. Mounts the `lessons/` directory for live editing

This workflow eliminates "works on my machine" issues by ensuring the Jupyter kernel runs inside a container with locked dependency versions.

## Cloud Alternatives

For users who cannot install Docker or Conda locally, the curriculum supports **GitHub Codespaces** and **Binder**. Both platforms read the [`.devcontainer/environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/.devcontainer/environment.yml) file and spin up a pre-configured VS Code instance in the browser, allowing you to execute every notebook without local configuration.

## Summary

- The **AI-For-Beginners** curriculum requires the Conda environment defined in [`.devcontainer/environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/.devcontainer/environment.yml) to ensure reproducible Jupyter execution.
- Activate the `ai4beg` environment before launching VS Code with `code .` so the Python extension auto-detects the correct interpreter.
- Store explicit paths in [`.vscode/settings.json`](https://github.com/microsoft/AI-For-Beginners/blob/main/.vscode/settings.json) to force VS Code to use the Conda environment for all notebook kernels.
- The `lessons/` directory contains 24 lesson folders with executable notebooks compatible with both PyTorch and TensorFlow.
- Optional container workflows via `.devcontainer/` provide fully isolated development environments without local dependency management.

## Frequently Asked Questions

### How do I switch between PyTorch and TensorFlow kernels in the notebooks?

The notebooks in the `lessons/` directory are framework-agnostic by design. Each notebook imports either PyTorch or TensorFlow based on the code cells you execute. Since both libraries are installed in the `ai4beg` environment defined in [`.devcontainer/environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/.devcontainer/environment.yml), you simply run the cells corresponding to your preferred framework without switching kernels.

### Can I use a different Python environment instead of Conda?

While the repository officially supports Conda via [`.devcontainer/environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/.devcontainer/environment.yml), you can manually install the dependencies listed in that file into a virtualenv or pipenv. However, you must update [`.vscode/settings.json`](https://github.com/microsoft/AI-For-Beginners/blob/main/.vscode/settings.json) to point `python.pythonPath` to your alternative environment’s Python binary to ensure VS Code launches the Jupyter kernel from that location.

### What should I do if VS Code does not detect the `ai4beg` environment?

Open the Command Palette (**Ctrl+Shift+P** or **Cmd+Shift+P**) and run **"Python: Select Interpreter."** If `ai4beg` does not appear, verify you activated the environment in your terminal before launching VS Code, or manually browse to the Python executable path (e.g., `~/anaconda3/envs/ai4beg/bin/python` on Linux/Mac or `%USERPROFILE%\anaconda3\envs\ai4beg\python.exe` on Windows).

### Is internet access required after the initial setup?

Yes, many notebooks download datasets or pre-trained models on first execution. If you are using the container workflow, ensure Docker has internet access during the build phase so that [`.devcontainer/environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/.devcontainer/environment.yml) can fetch packages from Conda and PyPI repositories.