Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Environment:Langchain ai Langchain Python 3 10 Runtime

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Python
Last Updated 2026-02-11 14:00 GMT

Overview

Python 3.10+ runtime environment with Pydantic 2.7.4+ required for all LangChain packages.

Description

All packages in the LangChain monorepo require Python 3.10 or higher (up to 3.14). The core framework depends on Pydantic 2.7.4+ for data validation and serialization, with explicit version detection at runtime. NumPy version requirements vary by Python version: Python < 3.13 uses numpy >= 1.26.4, while Python >= 3.13 requires numpy >= 2.1.0.

Usage

This is the base runtime environment for any LangChain application. Every LangChain package — core, partners, text-splitters, and standard-tests — requires this environment. It must be satisfied before installing any LangChain dependency.

System Requirements

Category Requirement Notes
OS Linux, macOS, Windows All major platforms supported
Python >= 3.10.0, < 4.0.0 Classified for 3.10, 3.11, 3.12, 3.13, 3.14
Build System hatchling Used by all packages in the monorepo

Dependencies

Core Python Packages

  • `langchain-core` >= 1.2.11 (current version)
  • `pydantic` >= 2.7.4, < 3.0.0
  • `langsmith` >= 0.3.45, < 1.0.0
  • `tenacity` != 8.4.0, >= 8.1.0, < 10.0.0
  • `jsonpatch` >= 1.33.0, < 2.0.0
  • `PyYAML` >= 5.3.0, < 7.0.0
  • `typing-extensions` >= 4.7.0, < 5.0.0
  • `packaging` >= 23.2.0
  • `uuid-utils` >= 0.12.0, < 1.0

Conditional Dependencies

  • `numpy` >= 1.26.4 (Python < 3.13)
  • `numpy` >= 2.1.0 (Python >= 3.13)

Development Tools

  • `uv` — Package installer and resolver
  • `ruff` >= 0.14.11 — Linter and formatter
  • `mypy` >= 1.19.1 — Static type checker
  • `pytest` >= 8.0.0 — Test framework

Credentials

No credentials required for the base runtime. See partner-specific environment pages for API key requirements.

Quick Install

# Install core package
pip install langchain-core>=1.2.11

# Or install with uv (recommended for development)
uv sync --all-groups

Code Evidence

Pydantic version detection from `libs/core/langchain_core/utils/pydantic.py:51-70`:

PYDANTIC_VERSION = version.parse(pydantic.__version__)

PYDANTIC_MAJOR_VERSION = PYDANTIC_VERSION.major
PYDANTIC_MINOR_VERSION = PYDANTIC_VERSION.minor

IS_PYDANTIC_V1 = False
IS_PYDANTIC_V2 = True

Python version requirement from `libs/core/pyproject.toml:25`:

requires-python = ">=3.10.0,<4.0.0"

Conditional NumPy from `libs/core/pyproject.toml:72-73`:

"numpy>=1.26.4; python_version<'3.13'",
"numpy>=2.1.0; python_version>='3.13'",

Common Errors

Error Message Cause Solution
`pydantic.errors.PydanticUserError` Pydantic v1 API used with v2 Upgrade code to Pydantic v2 API; LangChain no longer supports Pydantic v1
`ModuleNotFoundError: No module named 'numpy'` NumPy not installed `pip install numpy>=1.26.4` (or >= 2.1.0 for Python 3.13+)
`SyntaxError` on match/case Python < 3.10 Upgrade to Python 3.10+

Compatibility Notes

  • Pydantic: Only Pydantic v2 (>= 2.7.4) is supported. `IS_PYDANTIC_V1` is hardcoded to `False`.
  • tenacity: Version 8.4.0 is explicitly excluded due to a known bug.
  • Python 3.14: Classified as supported in partner packages (OpenAI, Anthropic).
  • NumPy: Different version requirements for Python 3.13+ due to NumPy 2.x compatibility.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment