Setup Guide

Environment Setup Guide

This guide will help you set up your development environment for the AI Engineering Syllabus.

๐Ÿ Python Installation

Option 1: Anaconda (Recommended for Beginners)

Download: https://www.anaconda.com/download

Advantages:

  • Includes Python + many libraries
  • Easy environment management
  • Works on Windows/Mac/Linux

Installation:

Create environment for AI course

conda create -n ai-course python=3.9 conda activate ai-course

Option 2: Python.org (Lightweight)

Download: https://www.python.org/downloads/

Install Python 3.9+

Create virtual environment:

python -m venv ai-env

Activate (Linux/Mac)

source ai-env/bin/activate

Activate (Windows)

ai-env\Scripts\activate

๐Ÿ“ฆ Essential Libraries

Core Libraries

Numerical computing

pip install numpy scipy pandas

Visualization

pip install matplotlib seaborn

Machine learning

pip install scikit-learn

Deep learning

pip install torch torchvision torchaudio

Jupyter notebooks

pip install jupyter ipykernel

Progress bars

pip install tqdm

Additional Libraries (Install as needed)

Computer vision

pip install opencv-python pillow albumentations

NLP

pip install transformers tokenizers sentencepiece

Optimization

pip install optuna

Deployment

pip install fastapi uvicorn gradio streamlit

Model export

pip install onnx onnxruntime

Memory profiling

pip install memory-profiler psutil

Experiment tracking

pip install wandb tensorboard

All-in-One Installation

Save this as requirements.txt:

numpy>=1.21.0
scipy>=1.7.0
pandas>=1.3.0
matplotlib>=3.4.0
seaborn>=0.11.0
scikit-learn>=1.0.0
torch>=2.0.0
torchvision>=0.15.0
jupyter>=1.0.0
tqdm>=4.62.0
opencv-python>=4.5.0
pillow>=9.0.0
albumentations>=1.3.0
fastapi>=0.100.0
uvicorn>=0.23.0
gradio>=3.40.0
onnx>=1.14.0
onnxruntime>=1.15.0
memory-profiler>=0.60.0
psutil>=5.9.0
optuna>=3.3.0

Then install:

pip install -r requirements.txt

๐Ÿ’ป Development Tools

1. VS Code (Recommended)

Download: https://code.visualstudio.com/

Essential Extensions:

  • Python (Microsoft)
  • Jupyter (Microsoft)
  • Pylance (Microsoft)
  • GitLens (optional)

Settings:

{
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": true,
    "python.formatting.provider": "black",
    "editor.formatOnSave": true
}

2. Jupyter Lab/Notebook

Install

pip install jupyterlab

Run

jupyter lab

Or classic notebook

jupyter notebook

3. Git

Download: https://git-scm.com/

Setup:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

๐Ÿ”ง Platform-Specific Optimizations

Linux

Intel MKL (Math Kernel Library):

conda install mkl mkl-service

OpenBLAS:

sudo apt-get install libopenblas-dev

Verify:

import numpy as np
np.show_config()

Windows

Install WSL2 (Windows Subsystem for Linux):
1. Open PowerShell as Administrator
2. Run: wsl --install
3. Restart computer
4. Install Ubuntu from Microsoft Store
5. Follow Linux setup above

Why WSL2?

  • Better performance for ML workloads
  • Access to Linux tools
  • Easier package management

macOS

Accelerate Framework (Built-in):

import numpy as np

NumPy automatically uses Accelerate on macOS

Homebrew (Package manager):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

๐Ÿงช Verify Installation

Create test_setup.py:

import sys
print(f"Python version: {sys.version}")

import numpy as np print(f"NumPy version: {np.__version__}")

import torch print(f"PyTorch version: {torch.__version__}") print(f"CUDA available: {torch.cuda.is_available()}")

import sklearn print(f"scikit-learn version: {sklearn.__version__}")

Test NumPy speed

import time size = 5000 a = np.random.rand(size, size) b = np.random.rand(size, size)

start = time.time() c = np.dot(a, b) end = time.time()

print(f"Matrix multiplication ({size}x{size}): {end-start:.2f}s") print("โœ… Setup successful!")

Run:

python test_setup.py

Expected output:

  • Python 3.9+
  • NumPy, PyTorch, scikit-learn versions
  • Matrix multiplication < 5 seconds

๐Ÿ“Š Memory Monitoring Tools

1. htop (Linux/Mac)

Install

sudo apt-get install htop # Linux brew install htop # Mac

Run

htop

2. Task Manager (Windows)

Press Ctrl + Shift + Esc

3. Python Memory Profiler

from memory_profiler import profile

@profile def my_function(): a = [1] (10 * 6) b = [2] (2 10 7) del b return a

my_function()

๏ฟฝ๏ฟฝ Docker (Optional)

Download: https://www.docker.com/get-started

Why Docker?

  • Consistent environment across machines
  • Easy deployment
  • Isolate projects

Basic Dockerfile:

FROM python:3.9-slim

WORKDIR /app

COPY requirements.txt . RUN pip install -r requirements.txt

COPY . .

CMD ["python", "main.py"]

Build and run:

docker build -t my-ai-project .
docker run -p 8000:8000 my-ai-project

โš™๏ธ Configuration Tips

1. Increase Jupyter Memory Limit

Edit ~/.jupyter/jupyter_notebook_config.py:

c.NotebookApp.max_buffer_size = 1024  1024  1024  # 1GB

2. Set PyTorch Threads

import torch
torch.set_num_threads(4)  # Use 4 CPU cores

3. Disable GPU (if you don’t have one)

import os
os.environ['CUDA_VISIBLE_DEVICES'] = ''

๐Ÿ” Troubleshooting

“ModuleNotFoundError”

Make sure you're in the right environment

which python pip list

Reinstall the package

pip install

“Out of Memory” during training

Reduce batch size

batch_size = 16 # Instead of 32

Use gradient accumulation

See ISL_OPTIMIZATION_GUIDE.md

Slow NumPy operations

Check if MKL is installed

python -c "import numpy as np; np.show_config()"

Install MKL

conda install mkl

Jupyter kernel crashes

Increase memory limit

Or restart kernel and clear outputs

โœ… Setup Checklist

  • [ ] Python 3.9+ installed
  • [ ] Virtual environment created and activated
  • [ ] Essential libraries installed (NumPy, PyTorch, scikit-learn)
  • [ ] Jupyter Lab/Notebook working
  • [ ] VS Code installed with Python extension
  • [ ] Git installed and configured
  • [ ] Test script runs successfully
  • [ ] Memory monitoring tool installed

๐Ÿš€ You’re Ready!

Once everything is set up, start with:

Module 1: Understanding AI & Smart Computing

Happy coding! ๐ŸŽ‰