Why local first
This course defaults to running LLMs on your own machine using Ollama. Why? Because local is free forever, private (your prompts never leave your machine), works offline, and teaches you the real internals of how agents work. Every prompt you send stays in your control.
We use Gemini only as a comparison and for tasks that need live internet (news, stock prices, etc.). But the core course is local. You'll own your infrastructure from day one.
- Ollama — runs LLMs locally on your machine (the main engine)
- Miniconda — Python environment manager (if you don't have it)
- Python packages —
ollama,google-generativeai,python-dotenv,requests - Free Gemini API key — for comparison and live data (optional but recommended)
Pick your platform
Jump to the section for your operating system below. Every OS ends up at the same place: a working python test_ollama.py and python test_gemini.py.
Mac setup
1. Install Homebrew (if you don't have it)
First, check if Homebrew is already installed:
If you see a version number, skip to step 2. If not, paste this from brew.sh:
2. Install Ollama
Start the service in the background:
The & runs it in the background. On recent Macs, brew services start ollama also works.
3. Pull your first local model
This downloads a 4.7 GB model (one-time, 3-10 min depending on your internet). This is your main chat model for the entire course.
4. Install Miniconda (if you don't have conda)
Check first:
If missing, download the macOS installer from conda.io/miniconda and run the .pkg file.
5. Create the course environment
conda activate ramayai first.
Windows setup
1. Install Ollama
Download the Windows installer from ollama.com/download/windows and run the .exe. Ollama will auto-start on login.
Verify in a new PowerShell window:
2. Pull your first model
3. Install Miniconda
Download from conda.io/miniconda and run the .exe. During installation, tick "Add Miniconda to my PATH" (despite the warning—it makes life easier).
4. Open Anaconda Prompt
Open Start menu and search for "Anaconda Prompt" (NOT regular PowerShell—conda only works inside Anaconda Prompt by default on Windows).
5. Create the course environment
Linux setup
1. Install Ollama (one-liner)
This also auto-starts the service via systemd. Verify:
2. Pull your first model
3. Install Miniconda
Follow the prompts and accept defaults. Close and reopen your terminal.
4. Create the course environment
Get your free Gemini key
- Go to aistudio.google.com/app/apikey and sign in with any Gmail account.
- Click "Create API key" → "Create API key in new project"
- Copy the key — it starts with
AIza... - Keep it handy. You'll paste it into
.envin the next section.
Download starter files
We've prepared a small bundle: llm.py (provider-agnostic wrapper), test_ollama.py, test_gemini.py, requirements.txt, .env.example, and .gitignore.
All platforms: Create a working folder
On Mac/Linux:
On Windows (in Anaconda Prompt):
Copy these files into your folder
File 1: llm.py
File 2: test_ollama.py
File 3: test_gemini.py
File 4: requirements.txt
File 5: .env (copy from .env.example and fill in your key)
File 6: .gitignore
Install packages
Edit .env with your Gemini key
Open .env in your editor and replace paste_your_gemini_key_here with your actual API key.
Run the smoke tests
Now test both providers to make sure everything is wired correctly.
Test Ollama (local)
Expected output: a sentence like "An AI agent is a system that perceives its environment and takes actions based on that perception."
Test Gemini (cloud)
Expected output: a similar sentence from Gemini.
If both print replies, you're done. Go to Lesson 01.
Troubleshooting
ModuleNotFoundError: No module named 'ollama'
You're not in the ramayai environment. Run:
models/gemini-2.0-flash is not found or 404
Your installed SDK doesn't support that model version. Update the model name in llm.py (default is already gemini-2.5-flash). Or update the SDK:
Quota exceeded or limit: 0 on Gemini
Your Google account's free-tier allocation is exhausted—usually happens with workspace (non-@gmail.com) accounts or accounts with broken billing. Fix:
- Create a new API key in a NEW project at aistudio.google.com/app/apikey (click "Create in new project")
- Or switch to a personal @gmail.com account
- Or add $5 of paid billing at console.cloud.google.com/billing
Connection refused / Could not connect to Ollama
Ollama service isn't running. Start it:
- Mac:
ollama serve &orbrew services start ollama - Windows: Open Ollama from Start menu
- Linux:
sudo systemctl start ollama
Ollama call takes 2+ minutes
Your laptop is slow or low on RAM. Try a smaller model:
Then call it with:
pip install fails on Windows with SSL errors
Make sure you're in Anaconda Prompt, not regular PowerShell. Conda's certificate store is different.
Python version is 3.9 / union syntax error
You're running system Python, not your conda env. Run:
Test your knowledge
Your local AI stack is live.
Now go build real agents.
Join the Best AI Program: The AI-Era Agentic Engineer — 5 months, fully online, with placement assistance. Week 1 is free.
Explore The AI-Era Agentic Engineer →