# How to Set Up the AI for Beginners Development Environment with Conda

> Quickly set up the AI for Beginners development environment using conda. Install all necessary Python dependencies with the environment yml file for a smooth learning experience.

- Repository: [Microsoft/AI-For-Beginners](https://github.com/microsoft/AI-For-Beginners)
- Tags: getting-started
- Published: 2026-08-10

---

**Use conda and the [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) file in microsoft/AI-For-Beginners to create a reproducible Python environment with all required dependencies for the Jupyter notebook curriculum.**

The **AI for Beginners** repository by Microsoft provides a comprehensive 12-week curriculum delivered through Jupyter notebooks. To run the lessons locally, you need a properly configured environment with specific versions of machine learning libraries. The maintainers provide an [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) file that pins all dependencies—ensuring that code examples execute without version conflicts.

## Prerequisites: Install Miniconda

Before setting up the project environment, you need the **conda** package manager. Microsoft recommends **Miniconda**, a minimal distribution that includes only conda, Python, and essential packages.

Download the appropriate installer for your operating system from [conda.io](https://conda.io/en/latest/miniconda.html). Follow the installation prompts and ensure conda is added to your system **PATH**.

## Clone the Repository

Retrieve the curriculum source code from GitHub:

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

```

The root directory contains the [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) file at [`/environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main//environment.yml)【/cache/repos/github.com/microsoft/AI-For-Beginners/main/environment.yml】, which defines the complete dependency stack including `ipykernel`, `jupyter`, `numpy`, `tensorflow`, `pytorch`, and `opencv`.

## Create and Activate the Conda Environment

### Step 1: Create the Environment

Run the following command to build the environment from the specification file:

```bash
conda env create --name ai4beg --file environment.yml

```

This reads the dependency list in [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) and resolves compatible versions. The process may take several minutes as conda downloads and installs packages.

### Step 2: Activate the Environment

Once creation completes, activate the environment:

```bash
conda activate ai4beg

```

Your shell prompt will change to indicate the active environment. All subsequent Python commands will use the isolated `ai4beg` environment.

### Step 3: Launch Jupyter

With the environment active, start the notebook server:

```bash
jupyter notebook

```

Alternatively, use JupyterLab for an enhanced interface:

```bash
jupyter lab

```

The notebook server will open in your default web browser. Navigate to any lesson directory—lessons are organized numerically under `/lessons/`.

## VS Code Integration (Optional)

For a richer development experience, use **Visual Studio Code** with the Python extension:

1. Open the `AI-For-Beginners` folder in VS Code
2. Ensure the `ai4beg` environment is activated in your terminal
3. The Python extension automatically detects the environment kernel

According to the setup documentation 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)【/cache/repos/github.com/microsoft/AI-For-Beginners/main/lessons/0-course-setup/how-to-run.md】, VS Code may prompt you to install additional extensions for optimal notebook support.

## Managing the Environment

### Update Dependencies

If the repository updates its [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml), refresh your environment:

```bash
conda env update --name ai4beg --file environment.yml --prune

```

### Remove the Environment

When finished with the curriculum, clean up:

```bash
conda env remove --name ai4beg

```

## Environment File Structure

The [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) specifies:

- **Core runtime**: `python`, `ipykernel`, `jupyter`
- **Deep learning**: `tensorflow`, `pytorch`, `torchvision`
- **Data/vision**: `numpy`, `pandas`, `opencv`, `pillow`
- **Utilities**: `matplotlib`, `scikit-learn`, `tqdm`

This comprehensive stack supports all 24 lessons without additional installation.

## Troubleshooting Common Issues

| Issue | Solution |
|-------|----------|
| `conda command not found` | Reinstall Miniconda and verify PATH configuration |
| Package conflicts during creation | Update conda: `conda update conda` |
| Kernel not appearing in Jupyter | Ensure `ipykernel` is installed: `conda install ipykernel` |

The main **README.md**【/cache/repos/github.com/microsoft/AI-For-Beginners/main/README.md】 contains a quick start section with condensed setup instructions for reference.

## Summary

- **Install Miniconda** to obtain the conda package manager
- **Clone** the `microsoft/AI-For-Beginners` repository
- **Create** the environment with `conda env create --name ai4beg --file environment.yml`
- **Activate** with `conda activate ai4beg` before running notebooks
- **Launch** Jupyter or use VS Code with the Python extension

The conda-based workflow ensures reproducibility across Windows, macOS, and Linux systems.

## Frequently Asked Questions

### Can I use pip instead of conda?

While possible, conda is strongly recommended. The [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) contains conda-specific packages (like `pytorch` with CUDA support) that pip cannot resolve optimally. Mixing package managers often causes dependency conflicts in data science workflows.

### How long does environment creation take?

Initial creation typically takes 5–15 minutes depending on connection speed and whether packages require compilation. Subsequent activations are instantaneous.

### What Python version does the environment use?

The [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) specifies Python 3.8 or higher as the base runtime, with individual lessons tested against the pinned package versions in that file.

### Do I need a GPU for the lessons?

No. The environment installs CPU-only versions of deep learning frameworks by default. GPU acceleration is optional—modify [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) or install additional CUDA drivers if you have compatible NVIDIA hardware.