How to Use GitHub Codespaces for Cloud-Based Development of the AI-For-Beginners Project
GitHub Codespaces provides a fully managed, container-based development environment that runs directly in your browser, allowing you to work through the AI-For-Beginners curriculum without installing Python, Conda, or any dependencies locally.
The AI-For-Beginners repository by Microsoft contains a complete 12-week curriculum covering neural networks, computer vision, natural language processing, and reinforcement learning. Because the project includes a Conda environment definition and Jupyter notebook-based lessons, GitHub Codespaces for cloud-based development is the fastest way to start learning—no local setup required.
Why GitHub Codespaces Works for AI-For-Beginners
The repository is purpose-built for cloud development through several key design decisions:
environment.ymldefines all required Python packages including TensorFlow, PyTorch, Keras, OpenCV, scikit-learn, and Jupyter—ensuring reproducible environments across all learners- Jupyter notebooks in the
lessons/folder are automatically recognized by VS Code's built-in notebook renderer - Docker-based containerization allows GPU-enabled runtimes for performance-intensive computer vision and NLP lessons (when available on your plan)
.devcontainermetadata tells GitHub exactly how to build the development image
According to the official setup guide in lessons/0-course-setup/how-to-run.md, cloud execution is the recommended path for learners who want to skip local installation.
Step-by-Step: Launching Your Codespace
1. Create a New Codespace
Navigate to the repository at https://github.com/microsoft/AI-For-Beginners, then:
- Click the green "Code" button
- Select the "Codespaces" tab
- Click "Create codespace on main"
GitHub provisions a virtual machine, clones the repository, and starts building a Docker container based on the project's configuration.
2. Wait for Container Build
The build process reads .devcontainer/environment.yml and executes conda env create. First-time builds typically take 3–5 minutes. The terminal panel shows real-time progress.
3. Open and Run Notebooks
Once the Codespace loads:
- Browse to
lessons/in the Explorer panel - Open any
.ipynbfile (example:lessons/3-NeuralNetworks/03-Perceptron/Perceptron.ipynb) - VS Code automatically starts a Jupyter server and renders the notebook
Execute cells sequentially—imports like import torch and import tensorflow as tf work immediately because the Conda environment ai4beg is pre-activated.
Verifying Your Environment
Run these commands in the integrated terminal to confirm everything is configured:
# Verify the Conda environment exists and is activated
conda activate ai4beg
# Check installed ML framework versions
python -c "import tensorflow as tf, torch, keras; print(f'TF: {tf.__version__}, PyTorch: {torch.__version__}, Keras: {keras.__version__}')"
# In any notebook cell, verify GPU availability
import torch
print("CUDA GPU available:", torch.cuda.is_available())
import tensorflow as tf
print("TensorFlow GPU devices:", tf.config.list_physical_devices('GPU'))
Understanding the Codespaces Architecture
| Component | Implementation in AI-For-Beginners |
|---|---|
| Base image | Ubuntu with Miniconda (via Microsoft's dev container images) |
| Environment definition | .devcontainer/environment.yml pins exact package versions |
| Post-create setup | conda env create -f environment.yml followed by activation |
| IDE connection | VS Code web interface over secure WebSocket |
| Optional GPU tier | NVIDIA drivers pre-installed for CUDA-enabled frameworks |
The environment.yml file referenced in the container build specifies channels (conda-forge) and dependencies including pytorch, tensorflow, opencv, matplotlib, numpy, and jupyterlab.
Running Code from the Terminal
Beyond interactive notebooks, you can execute lessons programmatically:
# Convert and execute a specific notebook to HTML
jupyter nbconvert --to html --execute lessons/3-NeuralNetworks/03-Perceptron/Perceptron.ipynb
# Run Python scripts directly
python lessons/4-ComputerVision/06-ImageClassification/mnist_example.py
# Start a standalone JupyterLab server (alternative to VS Code's renderer)
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser
Persisting and Sharing Your Work
All file modifications auto-save to the Codespace's persistent storage. To commit changes:
- Use the Source Control panel in VS Code (left sidebar)
- Stage changes, write a commit message, and push to your fork
- Alternatively, use the terminal:
git add . && git commit -m "progress" && git push
Each Codespace includes a full Linux terminal with standard Git tools, so contributions follow the standard workflow documented in etc/CONTRIBUTING.md.
Customizing Your Development Container
For advanced use cases, modify .devcontainer/devcontainer.json (create if absent):
{
"name": "AI-For-Beginners",
"image": "mcr.microsoft.com/devcontainers/python:3.10",
"features": {
"ghcr.io/devcontainers/features/nvidia-cuda:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-toolsai.jupyter"
]
}
},
"postCreateCommand": "conda env create -f environment.yml && echo 'conda activate ai4beg' >> ~/.bashrc",
"remoteUser": "vscode"
}
This configuration adds CUDA support, pre-installs VS Code extensions, and ensures the Conda environment activates automatically in new terminal sessions.
Troubleshooting Common Issues
- "Module not found" errors: Ensure the
ai4begenvironment is active (conda activate ai4beg) - Notebook kernel not found: Select "Python Environments" → "ai4beg" from the kernel picker in the top-right of any notebook
- Build timeouts: Large Conda environments may exceed default build limits; restart the Codespace or upgrade your GitHub plan
Summary
- GitHub Codespaces eliminates local setup by building a container with all AI-For-Beginners dependencies automatically
- The
environment.ymlfile ensures TensorFlow, PyTorch, and supporting libraries install reproducibly - Jupyter notebooks run natively in VS Code's web interface without additional configuration
- GPU acceleration is available on eligible Codespace plans for faster model training
- All changes persist to Git, enabling seamless collaboration and progress tracking
Frequently Asked Questions
How much does GitHub Codespaces cost for AI-For-Beginners?
GitHub provides 120 core-hours per month free on the Pro plan (60 hours on Free accounts). The AI-For-Beginners curriculum typically uses 2-core machines, giving you 60 hours of free usage monthly. Standard Linux instances cost approximately $0.18 per hour; GPU-enabled instances start at $0.99 per hour.
Can I use my local VS Code instead of the browser?
Yes. Click the hamburger menu (≡) in the top-left of any Codespace, select "Open in VS Code Desktop", and the remote extension connects your local editor to the cloud container. All files, terminals, and debug sessions remain synchronized.
What if the Conda environment fails to build?
Check the "Creation Log" from the Codespaces management page. Common fixes include: clearing the Codespace cache and rebuilding, updating the channels priority in environment.yml, or removing version pins for conflicting packages. The maintainers test builds against the current environment.yml, so filing an issue at microsoft/AI-For-Beginners is recommended for persistent failures.
Is internet access required after the Codespace loads?
Yes, for downloading datasets and model weights referenced in lessons. However, core library imports and local computations work offline once the container is running. Pre-download large datasets to /workspaces/AI-For-Beginners/data/ for offline resilience.
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 →