Core Python Dependencies for AI for Beginners: Complete Environment Guide

The AI for Beginners curriculum depends on TensorFlow 2.17.0, PyTorch, NumPy 1.26, Pandas 2.2.2, OpenCV, NLTK 3.10.0, and 30+ specialized libraries defined in environment.yml and requirements.txt to support deep learning, computer vision, NLP, and reinforcement learning workflows.

The Microsoft AI for Beginners repository provides a 24-lesson curriculum covering symbolic AI, neural networks, and ethical AI through hands-on Jupyter notebooks. Understanding the core Python dependencies for AI for Beginners is essential for creating a reproducible environment that matches the exact package versions used in course examples. These dependencies are centrally managed across two configuration files that separate system-level Conda packages from pip-installed Python libraries.

Environment Configuration Files

The project uses a dual-file strategy to ensure cross-platform consistency. This approach handles binary dependencies through Conda while managing pure Python packages through pip.

environment.yml (Conda Specification)

The root-level [environment.yml](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) defines the Conda environment, specifying the Python interpreter version, system libraries, and channels for scientific computing packages. This file references requirements.txt to ensure pip dependencies install within the Conda environment. A duplicate specification exists at [binder/environment.yml](https://github.com/microsoft/AI-For-Beginners/blob/main/binder/environment.yml) for cloud-based deployments.

requirements.txt (Pip Dependencies)

The [requirements.txt](https://github.com/microsoft/AI-For-Beginners/blob/main/requirements.txt) file lists pip-installable packages that form the functional core of the curriculum. These libraries are installed after the Conda environment is created, ensuring compatibility between system binaries and Python wrappers.

Deep Learning Frameworks

The curriculum teaches both major deep learning ecosystems, requiring specific versions to ensure notebook compatibility.

TensorFlow and Keras: The environment pins tensorflow==2.17.0 and keras==3.13.2 to provide the high-level APIs used in neural network lessons. These versions support the modern Keras 3.x API while maintaining compatibility with legacy TensorFlow workflows. The stack includes tensorflow-datasets==4.9.6 for standardized dataset loading and tensorflow-hub==0.16.1 for pre-trained model access.

PyTorch Ecosystem: Via Conda channels, the setup installs pytorch::pytorch, pytorch::torchvision, pytorch::torchtext, and pytorch::torchdata. This combination supports computer vision and natural language processing modules that use PyTorch's dynamic computation graphs, with torchvision handling image transformations and torchtext providing text processing utilities.

Data Manipulation and Scientific Computing

Core numerical operations rely on battle-tested scientific Python stacks.

NumPy and SciPy: The specification requires numpy=1.26 and scipy=1.13 for array operations, linear algebra, and statistical functions underlying machine learning algorithms.

Pandas and Scikit-learn: Data manipulation uses pandas==2.2.2 for tabular data structures, while scikit-learn provides traditional machine learning algorithms, preprocessing utilities, and model evaluation metrics used in early lessons.

Image Processing: scikit-image==0.24.0 complements the deep learning frameworks with traditional computer vision algorithms and image filtering techniques demonstrated in lessons like lessons/4-ComputerVision/07-ConvNets/tfcv.py.

Computer Vision and Image I/O

Visual AI lessons depend on robust image handling capabilities across multiple libraries.

OpenCV: Installed via conda-forge, OpenCV provides the cv2 module for advanced image processing, feature detection, and real-time video operations. This library is essential for computer vision lessons that bridge traditional algorithms with deep learning approaches.

Pillow and ImageIO: The environment includes pillow==12.2.0 for basic image format handling and imageio==2.35.0 for reading scientific image formats and video frames into NumPy arrays.

Natural Language Processing Libraries

Text processing and transformer model lessons require specialized linguistic tools and modern NLP frameworks.

NLTK: Version nltk==3.10.0 provides tokenization, stemming, and corpus access for introductory NLP concepts and classical text processing workflows.

Hugging Face and Tokenizers: The setup includes huggingface==0.0.1 and tokenizers==0.20.0 for working with modern transformer architectures and fast tokenization pipelines essential for state-of-the-art language models.

Gensim: Version gensim==4.3.3 supports word embedding models like Word2Vec and topic modeling algorithms covered in the curriculum's text analysis modules.

Reinforcement Learning and Simulation

The RL module introduces agent-based learning through standardized simulation environments.

OpenAI Gym: Version gym==0.26.2 provides standardized environments like CartPole-v1 for testing reinforcement learning algorithms and Q-learning implementations.

Pygame: Version pygame==2.6.0 supports custom environment creation and game-based AI demonstrations that visualize agent behavior in real-time.

Visualization and Workflow Utilities

Effective AI development requires monitoring, progress tracking, and remote data access capabilities.

Visualization: matplotlib=3.9 and seaborn==0.13.2 handle static plotting and statistical visualizations, while tensorboard==2.17.1 with tensorboard-data-server==0.7.2 enables real-time training metrics dashboards for TensorFlow models.

Development Tools: torchinfo==1.8.0 generates detailed PyTorch model summaries, tqdm==4.66.5 provides progress bars for training loops, and smart-open==7.0.4 enables streaming data access from cloud storage.

Jupyter Stack: The Conda environment includes ipykernel, ipython, ipywidgets, and jupyter to power the interactive notebook experience used throughout the lessons.

Verifying Your Installation

Run these snippets in a Jupyter notebook to confirm the core dependencies are correctly installed and accessible:


# Deep learning frameworks

import tensorflow as tf
import torch
import torchvision

print("TensorFlow version:", tf.__version__)
print("PyTorch version:", torch.__version__)

# Data handling

import numpy as np
import pandas as pd

print("NumPy array example:", np.arange(5))
print("Pandas DataFrame example:")
print(pd.DataFrame({"a": [1, 2], "b": [3, 4]}))

# Computer vision utilities

import cv2
import matplotlib.pyplot as plt
import imageio

# Load a sample image with OpenCV and display with Matplotlib

img = cv2.cvtColor(cv2.imread(cv2.samples.findFile("lena.jpg")), cv2.COLOR_BGR2RGB)
plt.imshow(img)
plt.axis('off')
plt.title("OpenCV → Matplotlib")
plt.show()

# Natural language processing

import nltk
nltk.download('punkt')
from nltk.tokenize import word_tokenize

sentence = "AI for Beginners makes learning fun."
tokens = word_tokenize(sentence)
print("NLTK tokens:", tokens)

# Reinforcement learning environment

import gym
env = gym.make('CartPole-v1')
obs = env.reset()
print("Initial observation:", obs)

Summary

  • The AI for Beginners curriculum relies on TensorFlow 2.17.0, PyTorch, NumPy 1.26, and Pandas 2.2.2 as foundational libraries for deep learning and data manipulation.
  • Dependencies are managed through environment.yml (Conda environment and system packages) and requirements.txt (pip-installed Python libraries) to ensure reproducibility across operating systems.
  • Specialized domains require OpenCV for computer vision, NLTK 3.10.0 and Hugging Face tools for NLP, and Gym 0.26.2 for reinforcement learning experiments.
  • Utility libraries like TensorBoard 2.17.1, tqdm, and torchinfo support model training visualization and workflow management across all 24 lessons.

Frequently Asked Questions

How do I install all core Python dependencies for AI for Beginners at once?

Run conda env create -f environment.yml from the repository root to create a complete environment that includes Python, PyTorch, OpenCV, and all pip dependencies. This command installs both the Conda packages specified in environment.yml and the libraries listed in requirements.txt in a single step. Activate the environment using conda activate ai4beginners before launching Jupyter to ensure all paths resolve correctly.

Can I use pip exclusively instead of Conda for the AI for Beginners setup?

While possible, using pip install -r requirements.txt alone requires manually installing system-level dependencies like OpenCV binaries and the correct Python version specified in environment.yml. The Conda approach is recommended because it handles non-Python dependencies automatically, ensuring the computer vision and scientific computing libraries compile correctly across Windows, macOS, and Linux.

Why does the curriculum include both TensorFlow and PyTorch?

The Microsoft AI for Beginners course teaches deep learning concepts using both frameworks to provide comprehensive industry coverage. TensorFlow 2.17.0 with Keras 3.13.2 demonstrates production-oriented static graphs and the Keras high-level API, while the PyTorch ecosystem (including torchvision and torchtext) illustrates dynamic computation graphs preferred in research settings. This dual approach ensures learners can interpret and implement AI research regardless of the underlying framework.

What Python version is required for the AI for Beginners curriculum?

The specific Python version is defined in the environment.yml file and installed automatically when creating the Conda environment. This ensures compatibility with pinned dependency versions like numpy=1.26 and scipy=1.13, preventing version conflicts that could break notebook examples in the computer vision and natural language processing lessons.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →