How to Set Up the AI for Beginners Conda Environment Locally: Complete Installation Guide
Clone the Microsoft AI for Beginners repository and create the ai4beg Conda environment using the root environment.yml to run all curriculum notebooks with a pre-configured Jupyter kernel.
The AI for Beginners curriculum by Microsoft provides hands-on machine learning lessons through Jupyter notebooks. To run these notebooks locally, you need a dedicated Conda environment named ai4beg that bundles all required dependencies. This guide walks through the complete setup process using the official environment definitions in the repository.
Prerequisites
Before installing the AI for Beginners Conda environment, ensure you have:
- Conda installed (Anaconda or Miniconda)
- Git for cloning the repository
- Approximately 2-5 GB of free disk space (less with sparse checkout)
Step 1: Clone the Microsoft AI for Beginners Repository
Start by downloading the curriculum source code. Navigate to your preferred directory and run:
git clone https://github.com/microsoft/AI-For-Beginners.git
cd AI-For-Beginners
This creates a local copy of the entire repository, including notebooks, data files, and configuration files.
Optional: Skip Large Translation Assets
If you want to reduce download size, use a sparse checkout to exclude the translations/ and translated_images/ folders:
git clone --filter=blob:none --sparse https://github.com/microsoft/AI-For-Beginners.git
cd AI-For-Beginners
git sparse-checkout set --no-cone '/*' '!translations' '!translated_images'
This approach downloads only the core curriculum content, saving significant storage space.
Step 2: Create the AI for Beginners Conda Environment
The repository includes a root-level environment.yml file that defines the complete environment. This file is also duplicated at .devcontainer/environment.yml for container-based development.
Create the environment using Conda:
conda env create -f environment.yml
What the Environment Includes
According to the [environment.yml](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) source, the ai4beg environment:
- Pulls packages from
defaultsandconda-forgechannels - Installs core scientific Python packages
- References
requirements.txtfor additional Python dependencies - Registers an IPython kernel (
ipykernel) for Jupyter notebook execution
The environment is designed as a single Conda environment that supports the entire curriculum, eliminating the need to switch environments between lessons.
Step 3: Activate the Environment and Verify Jupyter Kernel
Once creation completes, activate the environment:
conda activate ai4beg
Verify the Jupyter kernel is available:
jupyter kernelspec list
You should see python3 or ai4beg in the list of available kernels. The ipykernel package installed by environment.yml automatically registers this kernel.
Step 4: Launch Jupyter and Start Learning
With the environment active, start Jupyter Notebook or JupyterLab:
jupyter notebook
Or for JupyterLab:
jupyter lab
Navigate to any lesson folder and open the .ipynb notebook files. All imports should resolve without additional configuration.
Alternative: Using VS Code Dev Container
For a containerized setup, the repository includes [.devcontainer/environment.yml](https://github.com/microsoft/AI-For-Beginners/blob/main/.devcontainer/environment.yml). If using VS Code with the Dev Containers extension:
- Open the repository in VS Code
- Click "Reopen in Container" when prompted
- The environment builds automatically from the Dev Container configuration
This approach isolates the AI for Beginners setup from your host system entirely.
Troubleshooting Common Issues
Environment Creation Fails
If Conda cannot resolve dependencies, try updating Conda first:
conda update -n base conda
conda env create -f environment.yml --force
Kernel Not Showing in Jupyter
Manually install the kernel if needed:
ipython kernel install --user --name=ai4beg --display-name "Python (AI for Beginners)"
Package Conflicts
The environment.yml specifies channel priority. If conflicts persist, clear Conda's package cache:
conda clean --all
conda env create -f environment.yml
Summary
- Clone the
microsoft/AI-For-Beginnersrepository using standard or sparse checkout - Create the
ai4begConda environment from rootenvironment.yml - Activate with
conda activate ai4begto access the pre-configured Jupyter kernel - Launch Jupyter and run any notebook without additional setup
- The same environment definition exists at
.devcontainer/environment.ymlfor container workflows
Frequently Asked Questions
What Python version does the AI for Beginners environment use?
The environment.yml specifies Python 3.x compatible with the curriculum's dependencies. Specific version pinning is handled through requirements.txt, which the environment references for comprehensive package management. Check the source file for the exact version constraint.
Can I use pip instead of Conda for this setup?
While pip can install individual packages, the official AI for Beginners workflow relies on Conda for environment isolation and dependency resolution across scientific computing packages. The environment.yml orchestrates both Conda and pip installations internally via requirements.txt.
How do I update the environment when requirements change?
Delete and recreate the environment:
conda activate base
conda remove --name ai4beg --all
conda env create -f environment.yml
Alternatively, update in place with conda env update -f environment.yml if the changes are additive.
Is GPU support included in the environment?
The base environment.yml provides CPU-based scientific computing. GPU-accelerated packages like PyTorch or TensorFlow with CUDA support may require additional installation steps or modified environment files depending on your hardware and the specific lesson requirements.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →