# How to Use GitHub Codespaces for AI for Beginners: A Complete Setup Guide

> Set up GitHub Codespaces for AI for Beginners instantly. This guide helps you provision Python, TensorFlow, PyTorch, and Jupyter for a seamless AI learning experience without local setup.

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

---

**GitHub Codespaces provides a cloud-hosted, ready-to-run development environment that automatically provisions Python, TensorFlow, PyTorch, and Jupyter support so you can start the AI for Beginners curriculum without any local installation.**

The Microsoft **AI for Beginners** repository offers three ways to run the course materials, and GitHub Codespaces is the fastest path from zero to working code. This guide walks through the exact steps to launch a pre-configured container, activate the conda environment, and open your first notebook—all within your browser.

## What GitHub Codespaces Delivers for This Curriculum

When you create a Codespace from the `microsoft/AI-For-Beginners` repository, GitHub builds a Docker container that mirrors the local development environment 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) [【L49-L50】](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/0-course-setup/how-to-run.md). The container automatically:

- Installs the **conda environment** defined in [[`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml)](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml), including Python 3, TensorFlow, PyTorch, Keras, OpenCV, and scikit-learn
- Launches **VS Code in the browser** with full IntelliSense, Jupyter notebook support, and integrated terminal
- Mounts the **entire repository** with all 24 lessons, translations, and example code [【AGENTS.md†L74-L76】](https://github.com/microsoft/AI-For-Beginners/blob/main/AGENTS.md)

This architecture aligns with the "Primary Development Environment (Python/Jupyter)" specified in the project overview [【AGENTS.md†L20-L23】](https://github.com/microsoft/AI-For-Beginners/blob/main/AGENTS.md).

## Step-by-Step: Launching Your First Codespace

Follow these exact commands to start learning immediately:

### 1. Create the Codespace

Navigate to [https://github.com/microsoft/AI-For-Beginners](https://github.com/microsoft/AI-For-Beginners), click the **Code** button, select the **Codespaces** tab, then click **Create codespace on main**. GitHub provisions the container in approximately 30 seconds and opens VS Code in a new browser tab.

### 2. Activate the Pre-Installed Environment

Open the integrated terminal with `` Ctrl+` `` and run:

```bash
conda activate ai4beg

```

The `ai4beg` environment was built automatically from [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) during container initialization.

### 3. Start Jupyter Lab

From the same terminal:

```bash
jupyter lab

```

VS Code will detect the Jupyter server and offer to open it in the integrated notebook editor, or you can copy the provided URL into a new browser tab.

### 4. Open and Run a Lesson

In the VS Code file explorer, navigate to:

```

lessons/3-NeuralNetworks/03-Perceptron/Perceptron.ipynb

```

Click the notebook to open it in the Jupyter editor. Execute cells sequentially with **Shift + Enter** to follow the tutorial. The notebook runs entirely within the Codespace container—no local Python installation required.

### 5. Stop Your Codespace

When finished, click the **Stop** button in the top-right corner of the Codespace interface to avoid unnecessary compute charges. Your workspace state persists, so you can resume exactly where you left off.

## Key Configuration Files Behind the Scenes

Understanding these files helps troubleshoot or customize your environment:

| File | Purpose |
|------|---------|
| [[`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml)](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) | Conda environment specification with exact package versions for reproducibility |
| [[`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)](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/0-course-setup/how-to-run.md) | Official documentation covering all three execution methods, including Codespaces |
| [[`AGENTS.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/AGENTS.md)](https://github.com/microsoft/AI-For-Beginners/blob/main/AGENTS.md) | Project workflow summary and contributor guidelines referencing the Codespaces shortcut |
| [[`.devcontainer/devcontainer.json`](https://github.com/microsoft/AI-For-Beginners/blob/main/.devcontainer/devcontainer.json)](https://github.com/microsoft/AI-For-Beginners/blob/main/.devcontainer/devcontainer.json) | Codespace container configuration (if present in your fork) |

## Optional: Running the Quiz Application

The same cloud-based approach extends to the Vue.js quiz application in `etc/quiz-app/`. After activating the `ai4beg` environment, follow the instructions in [[`etc/quiz-app/README.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/etc/quiz-app/README.md)](https://github.com/microsoft/AI-For-Beginners/blob/main/etc/quiz-app/README.md) to serve the interactive knowledge checks from your Codespace.

## Summary

- **GitHub Codespaces** eliminates local setup for the AI for Beginners curriculum by provisioning a container from [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml)
- The **VS Code browser interface** provides notebook editing, terminal access, and debugging without local IDE installation
- The **`ai4beg` conda environment** comes pre-activated with TensorFlow, PyTorch, and all required dependencies
- **Persistent workspaces** let you pause and resume learning across sessions with zero reconfiguration

## Frequently Asked Questions

### Do I need a GPU to run the AI for Beginners notebooks in Codespaces?

No. The curriculum is designed to run on CPU, and the default Codespace container uses standard compute. For neural network lessons in later modules, training times remain reasonable on CPU. If you need GPU acceleration, you can configure a GPU-enabled machine type in Codespaces settings, though this incurs additional usage costs.

### How much does GitHub Codespaces cost for this curriculum?

GitHub provides **60 hours of free Codespaces usage per month** on the 2-core machine type for personal accounts. This is sufficient for the entire 24-lesson curriculum. Exceeding the free tier triggers billing at standard Codespaces rates, so always stop your Codespace when finished.

### Can I use my local VS Code instead of the browser version?

Yes. After creating a Codespace, click the **hamburger menu (≡) → Open in VS Code Desktop**. This connects your local VS Code installation to the remote container via the Remote-SSH extension, preserving all compute in the cloud while using your familiar local editor configuration.

### What happens if the conda environment fails to activate?

First verify the environment exists with `conda env list`. If `ai4beg` is missing, rebuild it manually: `conda env create -f environment.yml -n ai4beg`. This should not occur in standard operation—the container builds this environment automatically on first launch according to the repository's devcontainer configuration.