How to Set Up the AI for Beginners Development Environment with Conda
Use conda and the 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 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. Follow the installation prompts and ensure conda is added to your system PATH.
Clone the Repository
Retrieve the curriculum source code from GitHub:
git clone https://github.com/microsoft/AI-For-Beginners.git
cd AI-For-Beginners
The root directory contains the environment.yml file at /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:
conda env create --name ai4beg --file environment.yml
This reads the dependency list in 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:
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:
jupyter notebook
Alternatively, use JupyterLab for an enhanced interface:
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:
- Open the
AI-For-Beginnersfolder in VS Code - Ensure the
ai4begenvironment is activated in your terminal - The Python extension automatically detects the environment kernel
According to the setup documentation in 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, refresh your environment:
conda env update --name ai4beg --file environment.yml --prune
Remove the Environment
When finished with the curriculum, clean up:
conda env remove --name ai4beg
Environment File Structure
The 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-Beginnersrepository - Create the environment with
conda env create --name ai4beg --file environment.yml - Activate with
conda activate ai4begbefore 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 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 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 or install additional CUDA drivers if you have compatible NVIDIA hardware.
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 →