Use this guide if you prefer to run everything on your own laptop.
You have two paths: (A) native Python + virtual-env or (B) VS Code Dev Container with Docker.
Choose whichever feels easier—both lead to the same lessons.
| Tool | Version / Notes |
|---|---|
| Python | 3.10 + (get it from https://python.org) |
| Git | Latest (comes with Xcode / Git for Windows / Linux package manager) |
| VS Code | Optional but recommended https://code.visualstudio.com |
| Docker Desktop | Only for Option B. Free install: https://docs.docker.com/desktop/ |
💡 Tip – Verify tools in a terminal:
python --version,git --version,docker --version,code --version
git clone https://github.com/<your-github>/generative-ai-for-beginners
cd generative-ai-for-beginnerspython -m venv .venv # make one
source .venv/bin/activate # macOS / Linux
.\.venv\Scripts\activate # Windows PowerShell✅ Prompt should now start with (.venv)—that means you’re inside the env.
pip install -r requirements.txtSkip to Section 3 on API keys
We setup this repository and course with a development container that has a Universal runtime that can support Python3, .NET, Node.js and Java development. The related configuration is defined in the devcontainer.json file located in the .devcontainer/ folder at the root of this repository.
Why choose this? Identical environment to Codespaces; no dependency drift.
Docker Desktop – confirm docker --version works.
VS Code Remote – Containers extension (ID: ms-vscode-remote.remote-containers).
File ▸ Open Folder… → generative-ai-for-beginners
VS Code detects .devcontainer/ and pops a prompt.
Click “Reopen in Container”. Docker builds the image (≈ 3 min first time). When the terminal prompt appears, you’re inside the container.
Miniconda is a lightweight installer for installing Conda, Python, as well as a few packages.
Conda itself is a package manager, that makes it easy to setup and switch between different Python virtual environments and packages. It also comes in handy for installing packages that are not available via pip.
Follow the MiniConda installation guide to set it up.
conda --versionCreate a new environment file (environment.yml). If you are following along using Codespaces, create this within the .devcontainer directory, thus .devcontainer/environment.yml.
Add the following snippet to your environment.yml
name: <environment-name>
channels:
- defaults
- microsoft
dependencies:
- python=<python-version>
- openai
- python-dotenv
- pip
- pip:
- azure-ai-ml
Run the commands below in your command line/terminal
conda env create --name ai4beg --file .devcontainer/environment.yml # .devcontainer sub path applies to only Codespace setups
conda activate ai4begRefer to the Conda environments guide if you run into any issues.
Who’s this for?
Anyone who loves the classic Jupyter interface or wants to run notebooks without VS Code.
To start Jupyter locally, head over to the terminal/command line, navigate to the course directory, and execute:
jupyter notebookor
jupyterhubThis will start a Jupyter instance and the URL to access it will be shown within the command line window.
Once you access the URL, you should see the course outline and be able to navigate to any *.ipynb file. For example, 08-building-search-applications/python/oai-solution.ipynb.
Keeping your API keys safe and secure is important when building any type of application. We recommend not to store any API keys directly in your code. Committing those details to a public repository could result in security issues and even unwanted costs if used by a bad actor.
Here's a step-by-step guide on how to create a .env file for Python and add the GITHUB_TOKEN:
-
Navigate to Your Project Directory: Open your terminal or command prompt and navigate to your project's root directory where you want to create the
.envfile.cd path/to/your/project -
Create the
.envFile: Use your preferred text editor to create a new file named.env. If you're using the command line, you can usetouch(on Unix-based systems) orecho(on Windows):Unix-based systems:
touch .env
Windows:
echo . > .env
-
Edit the
.envFile: Open the.envfile in a text editor (e.g., VS Code, Notepad++, or any other editor). Add the following line to the file, replacingyour_github_token_herewith your actual GitHub token:GITHUB_TOKEN=your_github_token_here
-
Save the File: Save the changes and close the text editor.
-
Install
python-dotenv: If you haven't already, you'll need to install thepython-dotenvpackage to load environment variables from the.envfile into your Python application. You can install it usingpip:pip install python-dotenv
-
Load Environment Variables in Your Python Script: In your Python script, use the
python-dotenvpackage to load the environment variables from the.envfile:from dotenv import load_dotenv import os # Load environment variables from .env file load_dotenv() # Access the GITHUB_TOKEN variable github_token = os.getenv("GITHUB_TOKEN") print(github_token)
That's it! You've successfully created a .env file, added your GitHub token, and loaded it into your Python application.
🔐 Never commit .env—it’s already in .gitignore.
Full provider instructions live in providers.md.
| I want to… | Go to… |
|---|---|
| Start Lesson 1 | 01-introduction-to-genai |
| Setup an LLM Provider | providers.md |
| Meet other learners | Join our Discord |
| Symptom | Fix |
|---|---|
python not found |
Add Python to PATH or re-open terminal after install |
pip cannot build wheels (Windows) |
pip install --upgrade pip setuptools wheel then retry. |
ModuleNotFoundError: dotenv |
Run pip install -r requirements.txt (env wasn’t installed). |
| Docker build fails No space left | Docker Desktop ▸ Settings ▸ Resources → increase disk size. |
| VS Code keeps prompting to reopen | You may have both Options active; choose one (venv or container) |
| OpenAI 401 / 429 errors | Check OPENAI_API_KEY value / request rate limits. |
| Errors using Conda | Install Microsoft AI libraries using conda install -c microsoft azure-ai-ml |