-
Notifications
You must be signed in to change notification settings - Fork 35
Module 0.md
This workshop supports two setup options:
- Option A: macOS Local Setup - For macOS users who want to run locally
- Option B: GitHub Codespaces - Cloud-based, works on any platform
Choose the option that works best for you.
Homebrew is the package manager for macOS. If you don't have it:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Verify installation:
brew --versionPython is the primary language for ML components.
Install via Homebrew:
brew install python@3.11Verify installation:
python3 --version
# Expected: Python 3.11+ or newerGo is used for high-performance infrastructure services (API Gateway in Module 4).
Install via Homebrew:
brew install goVerify installation:
go version
# Expected: go1.21+ or newerDocker is required for containerization and running local Kubernetes.
Installation:
- Download Docker Desktop for Mac
- Intel Mac: Choose Intel chip version
- Apple Silicon (M1/M2/M3/M4): Choose Apple chip version
- Drag Docker.app to Applications folder
- Launch Docker Desktop from Applications
- Grant permissions when prompted (keychain access, etc.)
- Wait for Docker to start (whale icon in menu bar)
Verify installation:
docker --version
docker run hello-worldExpected output:
Hello from Docker!
This message shows that your installation appears to be working correctly.
Performance Configuration:
For optimal performance during the workshop:
- Open Docker Desktop โ Settings (gear icon)
- Go to Resources
- Allocate:
- CPUs: At least 4 (8 if you have 16GB+ RAM)
- Memory: At least 8GB (12GB if available)
- Disk: At least 20GB
- Click "Apply & Restart"
kubectl is the Kubernetes command-line tool.
Install via Homebrew:
brew install kubectlVerify installation:
kubectl version --client
# Expected: v1.28+ or newerkind (Kubernetes in Docker) runs local Kubernetes clusters.
Install via Homebrew:
brew install kindVerify installation:
kind version
# Expected: kind v0.20+ or newergit clone https://github.com/rfashwall/ml-con-workshop.git
cd ml-con-workshopVirtual environments isolate workshop dependencies from your system Python.
Create and activate virtual environment:
python3 -m venv venv
source venv/bin/activateVerify activation:
Your prompt should show (venv) prefix:
(venv) user@MacBook-Pro ml-con-workshop %
Install Python dependencies:
# Upgrade pip
pip install --upgrade pip
# Install all workshop dependencies
pip install -r requirements.txtWhat gets installed:
- MLflow 2.9+: Experiment tracking and model registry
- BentoML 1.4+: Model packaging and serving
- Transformers 4.35+: Hugging Face transformers
- PyTorch 2.1+: Deep learning framework
- Datasets: Hugging Face datasets library
- scikit-learn: Traditional ML algorithms
- FastAPI: Web framework for APIs
- Pydantic: Data validation
- Prometheus Client: Metrics collection
- Kubeflow Pipelines SDK: ML workflow orchestration
- pytest: Testing framework
Verify installation:
pip list | grep -E "mlflow|bentoml|transformers"Expected output:
bentoml 1.4.x
mlflow 2.9.x
transformers 4.35.x
Create a local single-node Kubernetes cluster using kind.
kind create cluster --config modules/module-0/kind.yamlExpected output:
Creating cluster "mlops-workshop" ...
โ Ensuring node image (kindest/node:v1.34.0)
โ Preparing nodes
โ Writing configuration
โ Starting control-plane
โ Installing CNI
โ Installing StorageClass
Set kubectl context to "kind-mlops-workshop"
Verify cluster:
# Check cluster info
kubectl cluster-info --context kind-mlops-workshop
# List nodes (should show 1 node)
kubectl get nodes
# Check all system pods are running
kubectl get pods -n kube-systemExpected node output:
NAME STATUS ROLES AGE VERSION
mlops-workshop-control-plane Ready control-plane 2m v1.34.0
Untain Node
kubectl taint nodes mlops-workshop-control-plane node-role.kubernetes.io/control-plane:NoSchedule-Test that MLflow is working correctly:
mlflow uiExpected output:
[INFO] Starting gunicorn 20.1.0
[INFO] Listening at: http://127.0.0.1:5000
Test in browser:
- Open http://localhost:5000
- You should see the MLflow tracking UI
- No experiments yet (this is expected)
Stop the server:
Press Ctrl+C in the terminal.
If you encounter architecture issues:
Some Python packages may require Rosetta 2 for compatibility:
softwareupdate --install-rosettaDocker and kind work natively on Apple Silicon, so you shouldn't need Rosetta for containerization.
Symptoms:
-
docker psreturns "Cannot connect to the Docker daemon" - Docker Desktop shows errors
Solutions:
- Check Docker Desktop is running (whale icon in menu bar)
- Grant permissions in System Settings โ Privacy & Security
- Restart Docker Desktop: Docker menu โ Restart
- If still failing, quit Docker completely and relaunch
Error: "Address already in use :5000"
Find and kill the process using the port:
lsof -i :5000
kill -9 <PID>Or use a different port:
mlflow ui --port 5001Error: "failed to create cluster"
# Delete existing cluster
kind delete cluster --name mlops-workshop
# Ensure Docker is running
docker ps
# Recreate cluster
kind create cluster --name mlops-workshopIf PyTorch installation is very slow:
# Install CPU-only version (faster, smaller download)
pip install torch --index-url https://download.pytorch.org/whl/cpuIf you see SSL certificate errors:
# Update certificates
pip install --upgrade certifiVerification checklist:
- Homebrew installed
- Python 3.11+ installed
- Go 1.21+ installed
- Docker Desktop installed and running
- kubectl installed
- kind installed
- Repository cloned
- Virtual environment created and activated
- All Python packages installed (mlflow, bentoml, transformers, torch)
- kind cluster "mlops-workshop" created
-
kubectl get nodesshows 1 node in Ready status - MLflow UI starts at http://localhost:5000
A cloud-based development environment that runs in your browser. No local installation required!
Benefits:
- โ Zero setup - all tools pre-installed
- โ Works on any device (Windows, Mac, Linux, even iPad!)
- โ Consistent environment for everyone
- โ Free tier: 60 hours/month (120 hours for Pro users)
- โ 4-core CPU, 8GB RAM, 32GB storage
Perfect for:
- Users who don't want to install tools locally
- Windows or Linux users (since we only support macOS locally)
- Participants with limited disk space or older hardware
- Anyone who wants a ready-to-go environment
- Go to github.com/rfashwall/ml-con-workshop
- Click the "Fork" button in the top-right corner
- Wait for the fork to complete (takes ~30 seconds)
- You'll be redirected to your fork:
github.com/YOUR_USERNAME/ml-con-workshop
- On your forked repository, click the green "Code" button
- Select the "Codespaces" tab
- Click "Create codespace on main"
- Wait 3-5 minutes for the environment to build
What happens during setup:
- A virtual machine is provisioned for you
- VS Code opens in your browser
- All tools are automatically installed (Python, Go, Docker, kubectl, kind)
- Python dependencies are installed
- You're ready to start!
Once the codespace opens:
- โ VS Code runs in your browser
- โ Terminal is available at the bottom
- โ All tools are pre-installed
- โ Workshop repository is cloned
Verify your environment:
python --version # Should show Python 3.11+
go version # Should show Go 1.21+
docker --version # Should show Docker 24+
kubectl version --client
kind versionYour codespace includes everything needed for the workshop:
| Tool | Version | Purpose |
|---|---|---|
| Python | 3.11+ | ML model development |
| Go | 1.21+ | Infrastructure services |
| Docker | 24+ | Containerization (Docker-in-Docker) |
| kubectl | 1.28+ | Kubernetes CLI |
| kind | 0.20+ | Local Kubernetes clusters |
| MLflow | 2.9+ | Experiment tracking |
| BentoML | 1.4+ | Model serving |
| Transformers | 4.35+ | NLP models |
| PyTorch | 2.1+ | Deep learning |
All Python dependencies from requirements.txt are installed automatically!
When you run services in the workshop, Codespaces automatically forwards ports.
Services you'll run:
- MLflow UI (port 5000)
- BentoML (port 3000)
- Kubeflow (port 8080)
- Prometheus (port 9090)
- Grafana (port 3001)
How port forwarding works:
-
Start a service in the terminal:
mlflow ui
-
Look for the "Ports" tab at the bottom of VS Code (next to Terminal)
-
You'll see port 5000 listed with a status
-
Click the globe icon (๐) next to the port to open in browser
-
The URL will be:
https://[your-codespace-name]-5000.app.github.dev
Making ports public:
By default, ports are private (only you can access). To share with others:
- Right-click the port in the Ports tab
- Select "Port Visibility" โ "Public"
- Click files in the sidebar to open them
- Edit code just like VS Code desktop
- Changes are auto-saved
- Access terminal at bottom of screen
- Multiple terminals: Click "+" to create new ones
- Run commands exactly as in local setup
Pre-installed VS Code extensions:
- Python extension
- Go extension
- Docker extension
- Kubernetes extension
- Your codespace persists when you close the browser
- Files and changes are saved
- Returns to the same state when you reopen
- Auto-deletes after 30 days of inactivity (free tier)
If the automatic setup doesn't complete successfully:
Run the setup script manually:
bash .devcontainer/post-create.shVerify installation:
python --version # Should show Python 3.11+
go version # Should show Go 1.21+
docker --version # Should show Docker 24+
kubectl version --client
kind versionInstall Python dependencies (if needed):
pip install -r requirements.txtWhat you get:
- 60 hours/month for free accounts
- 120 hours/month for GitHub Pro/Team/Enterprise
- 4-core CPU, 8GB RAM, 32GB storage
This workshop needs:
- ~6 hours of active use
- You can complete the workshop multiple times on the free tier!
What works great:
- Running Python scripts
- Training small/medium ML models
- Building and running containers
- Local Kubernetes with kind
What may be slower:
- kind clusters (compared to local Docker)
- Large Docker image builds
- Training very large ML models
- Network operations (downloading large datasets)
Typical performance:
- kind cluster creation: ~3-5 minutes (vs 2-3 minutes local)
- Python package installation: ~5-10 minutes (same as local)
- MLflow UI: instant (same as local)
You have 32GB storage:
- Workshop uses ~5-8GB
- Docker images can grow quickly
Clean up regularly:
# Remove unused Docker resources
docker system prune -a
# Clean Python caches
find . -type d -name __pycache__ -exec rm -rf {} +
pip cache purgeSymptoms:
- Can't access MLflow UI or other services
- "Unable to connect" errors in browser
Solutions:
- Check the "Ports" tab at bottom of VS Code
- Verify the service is actually running:
# Check if process is listening lsof -i :5000 - Right-click port โ "Port Visibility" โ "Public"
- Restart the service:
# Stop with Ctrl+C, then restart mlflow ui - If still failing, restart the codespace:
- Click "Codespaces" menu (bottom-left)
- Select "Restart Codespace"
Error: Cannot connect to Docker daemon
Solutions:
-
Check Docker status:
docker ps
-
If Docker isn't running, the codespace may need restart:
- Click "Codespaces" menu (bottom-left)
- Select "Restart Codespace"
- Wait 2-3 minutes for full restart
-
Verify Docker-in-Docker is enabled:
# Should see docker containers docker ps
Symptoms:
- "No space left on device" errors
- Docker builds failing
Solutions:
# Check disk usage
df -h
# Clean up Docker (this can free 5-10GB!)
docker system prune -a
# Clean up Python caches
find . -type d -name __pycache__ -exec rm -rf {} +
pip cache purge
# Remove old kind clusters
kind get clusters
kind delete cluster --name old-cluster-nameSymptoms:
- Commands taking very long
- Browser feels sluggish
- High latency
Solutions:
-
Close unused browser tabs (codespaces use resources in your browser)
-
Stop unnecessary services:
# Stop MLflow if not needed pkill -f mlflow # Stop kind cluster if not actively using kind delete cluster --name mlops-workshop
-
Upgrade to larger machine type:
- Click "Codespaces" menu (bottom-left)
- Select "Change machine type"
- Options: 8-core (2x faster, ~$0.36/hour) or 16-core (4x faster, ~$0.72/hour)
- Note: This costs more but can be worth it for heavy workloads
-
Check your internet connection:
- Codespaces requires stable internet
- Try moving closer to WiFi router
- Use wired connection if possible
-
Try a different browser:
- Chrome/Edge work best
- Firefox can be slower
- Safari may have compatibility issues
Solutions:
- Open a new terminal: Click "+" in terminal panel
- Restart codespace: Codespaces menu โ "Restart Codespace"
- If completely frozen, close browser tab and reopen codespace
Symptoms:
-
ModuleNotFoundErrorwhen importing mlflow, bentoml, etc.
Solutions:
# Check if virtual environment is activated
which python
# Should show: /workspaces/ml-con-workshop/venv/bin/python
# Activate if needed
source venv/bin/activate
# Reinstall dependencies
pip install -r requirements.txt
# Verify installation
pip list | grep -E "mlflow|bentoml|transformers"Solutions:
# Check if kind cluster exists
kind get clusters
# Create cluster if missing
kind create cluster --name mlops-workshop
# Set context
kubectl config use-context kind-mlops-workshop
# Verify
kubectl get nodesTo maximize your free hours:
-
Stop your codespace when not using:
- Codespaces menu โ "Stop Codespace"
- Auto-stops after 30 minutes of inactivity (default)
- Doesn't count against your hours when stopped
-
Delete old codespaces:
- Go to github.com/codespaces
- Delete codespaces you're done with
- Frees up storage and organization
-
Monitor usage:
- Check usage: github.com/settings/billing
- Set spending limits to avoid surprise charges
Performance tips:
-
Use codespace-specific optimizations:
- The
.devcontainerconfiguration is optimized for codespaces - Don't modify Docker resources (managed automatically)
- The
-
Precompile when possible:
- Cache Docker layers
- Use prebuilt images from the workshop
-
Clean up regularly:
- Run
docker system prune -aevery few days - Remove old kind clusters you're not using
- Run
| Feature | Codespaces | macOS Local |
|---|---|---|
| Storage | 32GB (cloud) | Unlimited (your disk) |
| Performance | Good (4-core) | Depends on your Mac |
| Cost | Free (60 hrs/month) | Free (after initial setup) |
| Portability | Access anywhere | Only on your Mac |
| Offline | Requires internet | Works offline |
| Persistence | 30 days inactive | Forever |
Choose Codespaces if:
- You don't have a Mac
- You want zero setup time
- You work from multiple devices
- You have limited disk space
Choose macOS Local if:
- You want maximum performance
- You want permanent local environment
Run this complete verification:
# Check all tools
python3 --version && \
go version && \
docker --version && \
kubectl version --client && \
kind version && \
kind get clusters
# Expected output:
# Python 3.11+
# go version go1.21+
# Docker version 24.0+
# Client Version: v1.34+
# kind v0.30+
# mlops-workshopTest Python packages:
pip list | grep -E "mlflow|bentoml|transformers|torch"
# Expected: All packages listed with correct versionsTest Kubernetes:
kubectl get nodes
# Expected: 2 node in Ready statusRun this verification:
# Check all tools
python --version && \
go version && \
docker --version && \
kubectl version --client && \
kind version
# All should show correct versionsTest Python environment:
# Should show virtual environment path
which python
# Check packages are installed
pip list | grep -E "mlflow|bentoml|transformers"| Command | Purpose |
|---|---|
python --version (or python3) |
Check Python version |
go version |
Check Go version |
docker ps |
List running containers |
kubectl get nodes |
List Kubernetes nodes |
kind get clusters |
List kind clusters |
source venv/bin/activate |
Activate virtual environment (macOS) |
deactivate |
Deactivate virtual environment |
pip list |
List installed packages |
mlflow ui |
Start MLflow tracking server |
docker system prune -a |
Clean up Docker (free disk space) |
Once your environment is set up (either macOS local or Codespaces):
- โ Verify all tools are working using the verification section above
- โ Proceed to Module 1 to start training your first ML model!
- ๐ก Bookmark this page for reference throughout the workshop
- ๐ Review the Troubleshooting Guide if you encounter issues
- Python Installation Guide
- Go Installation Guide
- Docker Desktop Documentation
- kubectl Documentation
- kind Quick Start
| Home | Next |
|---|---|
| ๐ Home | Module 1: Model Training & Experiment Tracking โ |
MLOps Workshop | GitHub Repository