Skip to main content
Before diving into LangGraph, confirm your local environment is ready. This guide keeps things lightweight and beginner-friendly while ensuring reproducible setups for development and experimentation. Minimum requirements
  • Python 3.10 or later
  • A code editor or Jupyter notebook (Jupyter is excellent for inline experimentation)
  • A virtual environment (venv or Conda) to isolate dependencies
  • A few Python packages (listed below)
We recommend Jupyter Notebook for interactive experimentation and Visual Studio Code for larger projects. Always use a virtual environment to avoid dependency conflicts.
The image shows a terminal interface with options to launch Python 3.10+, Jupyter Notebook, and VSCode, along with "venv" and "conda" highlighted below.

Install system prerequisites and pip

First, check whether pip is available:
If pip is missing, install it using your distribution’s package manager. Use the appropriate command for your platform: Once pip is available, proceed to install the Python packages.

Install core Python packages

Install the minimal required packages and a few recommended utilities. The table below summarizes purpose and installation. Install the packages:

Virtual environments

Use a virtual environment to isolate dependencies. Two common approaches: Using venv (standard library):
Using Conda:

API keys and secure storage

To call OpenAI models (e.g., GPT-4, GPT-3.5), you need an API key from the OpenAI dashboard: https://platform.openai.com/account/api-keys Important best practices:
  • Never hard-code API keys in source files.
  • Use environment variables or a secrets manager for production.
  • For local development, use a .env file with python-dotenv and add .env to .gitignore.
Example .env file:
Load it in Python:
Store secrets in environment variables or a secure secrets manager. Use python-dotenv only for local development; never commit .env to version control.
Recommended project layout
  • Keep an organized layout from the start. Example structure:
The image is a slide featuring the title "API Keys and Setup" alongside the logos for OpenAI ChatGPT 4.0 and LangSmith.

Quick system test

Create a lightweight script to validate imports, verify the OpenAI API key is present, and make a minimal Chat API call. Save this as system_test.py and run it after activating your virtual environment and setting OPENAI_API_KEY or creating a .env.
Expected minimal output (example):
Using the OpenAI API may incur charges. Monitor usage and billing in your OpenAI dashboard, and prefer small test calls when validating integration.
If the script runs and the OpenAI call succeeds, your development environment is ready for the rest of the LangGraph material. If you see import errors, confirm your virtual environment is activated and the packages installed without errors. Additional references

Watch Video