LangChainLangChain 1.4 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
46 small wins to finish your pathNext lesson →

Installation and setup

LangChain installs from PyPI with one pip command: the langchain package brings the framework, its core types, and the runtime that runs its agents.

Last updated: 27 Sep, 2026 · LangChain 1.4

The langchain package brings langchain-core, which holds the message types and the base classes every model builds on, and langgraph, which runs the agent loop.

Installing the langchain package

bash
pip install "langchain==1.4.2"

In a notebook, prefix it with a percent sign: %pip install "langchain==1.4.2".

Check the install

Check which version Python finds:

Example
from importlib.metadata import version

print(version("langchain"))
print(version("langchain-core"))

Reading the version numbers

  • 1.4.2 is the langchain version you pinned.
  • 1.6.3 is langchain-core, pulled in as a dependency; it holds the message types and the base classes every model builds on.

Lessons 26 and 29 install what they need when they need it: a text splitter, numpy and MCP support.

Keys, for when you want a hosted modelOptional

Every lesson runs on a stand-in model you write in lesson 3. To use a hosted model instead, install its provider package and set its key as an environment variable. The real-model lesson makes the switch with init_chat_model.

ProviderKeyVariablePackage and model string
GroqFree, console.groq.com/keysGROQ_API_KEYlangchain-groq, "groq:openai/gpt-oss-120b"
GeminiFree, aistudio.google.com/apikeyGOOGLE_API_KEYlangchain-google-genai, "google_genai:gemini-2.5-flash"
OpenRouterFree models end in :free, openrouter.ai/keysOPENROUTER_API_KEYlangchain-openrouter, "openrouter:google/gemma-4-31b-it:free"

Install a provider package and set its key. Groq is shown here.

pip install "langchain-groq==1.1.3"
export GROQ_API_KEY=gsk_...
Watch out. Pin the version. pip install langchain with no version pulls whatever is newest, and an API that moved can break a lesson that ran yesterday.
Try it yourself
  • Run the version check and confirm langchain is 1.4.2.
  • Run pip show langchain and find langgraph in its Requires line.
  • Import from langchain.messages import HumanMessage and confirm no error.

Little by little, you're building something great.