Project Setup
OpenAI and Ollama are ready. This lesson installs Python, creates a virtual environment, and lays out the project folder LangChain will use. Same steps every time you start a small LLM script.
Install Python
LangChain runs on Python. This course uses 3.14.5. If python --version already shows 3.14.5, skip to verify below — otherwise download the installer.
Download the latest version for Windows
Or get the standalone installer for Python 3.14.5
Looking for Python with a different OS? Python for Windows, Linux/Unix, macOS, Android, other
Want to help test development versions of Python 3.15? Pre-releases, Docker images
Active Python releases
For more information visit the Python Developer's Guide.
Install Python 3.14.5 (64-bit)
python is not found, reopen the installer and enable PATH, or reinstall with the checkbox on.One folder for the course
Create langchain-course on your machine — Desktop, Documents, or anywhere you keep coding projects. Everything for the HTML tutorial helper from What is LangChain? will live inside this directory.
html_tutorial_helper.py comes in a later lesson — create the empty file now if you like.Or download the starter ZIP
Prefer not to create every file by hand? Download the zip below. It contains requirements.txt, a .env.example template, .gitignore, and a placeholder html_tutorial_helper.py. Unzip, then follow the venv and pip steps in the sections below.
langchain-course-starter.zip
Pre-built project files for this lesson
Inside the archive
- ◇README.txt
- ◇requirements.txt
- ◇.env.example
- ◇.gitignore
- ◇hello_langchain.py
- ◇hello_ollama.py
- ◇model_params_demo.py
- ◇html_tutorial_helper.py
langchain-course if you like, then copy .env.example to .env.Environment setup
Do not install LangChain globally on your PC. Use a virtual environment inside the project folder — a private copy of pip packages that stays with this course only.
Inside langchain-course, run the commands below. Activate the venv before every session; your prompt shows (.venv) when it is on.
| Step | Windows (PowerShell) | macOS / Linux |
|---|---|---|
| Create venv | python -m venv .venv | python3 -m venv .venv |
| Activate | .\.venv\Scripts\Activate.ps1 | source .venv/bin/activate |
| Deactivate | deactivate | |
source .venv/bin/activate. See venv docs.Dependencies
Add a requirements.txt file listing what the scripts need. Install with pip while the venv is active.
.env.Secrets and Git
Copy your OpenAI key into .env. Add OLLAMA_BASE_URL now so switching to a local model later is a one-line change in code, not a hunt through old notes.
.env or .venv/.Quick check
With the venv active, run pip show langchain — you should see a version line and the install path inside .venv. If that works, the project shell is ready. The next lesson adds hello_langchain.py — your first LangChain script that reads .env and calls OpenAI.
What's Next
Project folder, venv, and packages are set. Next: your first LangChain script.