Pinecone Python SDK
Project Links
Meta
Author: Pinecone Systems, Inc.
Requires Python: >=3.10
Classifiers
Development Status
- 5 - Production/Stable
Intended Audience
- Developers
- Information Technology
- Science/Research
- System Administrators
Operating System
- OS Independent
Programming Language
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
Topic
- Database
- Software Development
- Software Development :: Libraries
- Software Development :: Libraries :: Application Frameworks
- Software Development :: Libraries :: Python Modules
Pinecone Python SDK
The Pinecone Python SDK provides a client for the Pinecone vector database. Use it to create and manage indexes, upsert and query vectors, and run inference operations from Python.
Requires Python 3.10+.
Installation
pip install pinecone
For development dependencies (testing, type checking, linting):
pip install pinecone[dev]
Quick start
from pinecone import Pinecone, ServerlessSpec
# Initialize the client
pc = Pinecone(api_key="your-api-key")
# Create a serverless index
pc.indexes.create(
name="movie-recommendations",
dimension=1536,
metric="cosine",
spec=ServerlessSpec(cloud="aws", region="us-east-1"),
)
# Connect to the index
index = pc.index("movie-recommendations")
# Upsert vectors
index.upsert(
vectors=[
("movie-42", [0.012, -0.087, 0.153]), # 1536-dim embedding
("movie-87", [0.045, 0.021, -0.064]), # 1536-dim embedding
],
namespace="movies-en",
batch_size=100, # split larger inputs into parallel batches automatically
)
# Query for similar vectors
results = index.query(
vector=[0.012, -0.087, 0.153], # 1536-dim embedding
top_k=10,
namespace="movies-en",
)
for match in results.matches:
print(f"{match.id}: {match.score:.4f}")
Async usage
The SDK provides an async client for use with asyncio:
import asyncio
from pinecone import AsyncPinecone
async def main():
async with AsyncPinecone(api_key="your-api-key") as pc:
desc = await pc.indexes.describe("movie-recommendations")
index = await pc.index(host=desc.host)
async with index:
results = await index.query(
vector=[0.012, -0.087, 0.153], # 1536-dim vector
top_k=10,
namespace="movies-en",
)
for match in results.matches:
print(f"{match.id}: {match.score:.4f}")
asyncio.run(main())
Configuration
API key
Pass the API key directly or set the PINECONE_API_KEY environment variable:
from pinecone import Pinecone
# Explicit API key
pc = Pinecone(api_key="your-api-key")
# From environment variable (PINECONE_API_KEY)
pc = Pinecone()
Custom host
Connect to a specific control plane host:
pc = Pinecone(api_key="your-api-key", host="https://api.pinecone.io")
Timeout
Configure request timeouts in seconds:
pc = Pinecone(api_key="your-api-key", timeout=30)
Debug logging
Enable debug logging by setting the PINECONE_DEBUG environment variable:
export PINECONE_DEBUG=1
Development
Setup
Clone the repository and install dependencies with uv:
uv sync
Tests
uv run pytest tests/unit/ -x -v
Type checking
uv run mypy --strict pinecone/
Linting and formatting
uv run ruff check --fix
uv run ruff format
License
Apache-2.0. See LICENSE for details.
9.0.1
May 19, 2026
9.0.1rc1
May 18, 2026
9.0.0
May 04, 2026
9.0.0rc2
May 04, 2026
9.0.0rc1
May 04, 2026
8.2.0rc2
May 04, 2026
8.2.0rc1
May 04, 2026
8.1.2
Apr 08, 2026
8.1.1
Apr 02, 2026
8.1.0
Feb 19, 2026
8.1.0rc1
Feb 17, 2026
8.0.1
Feb 11, 2026
8.0.0
Nov 18, 2025
7.3.1a1
Oct 03, 2025
7.3.1.dev8
Oct 01, 2025
7.3.1.dev7
Oct 01, 2025
7.3.1.dev6
Oct 01, 2025
7.3.1.dev5
Oct 01, 2025
7.3.1.dev4
Sep 30, 2025
7.3.1.dev3
Sep 25, 2025
7.3.1.dev2
Sep 24, 2025
7.3.1.dev1
Sep 24, 2025
7.3.0
Jun 27, 2025
7.2.0
Jun 18, 2025
7.1.0
Jun 16, 2025
7.1.0rc1
Jun 16, 2025
7.0.2
May 28, 2025
7.0.2.dev1
May 27, 2025
7.0.1
May 21, 2025
7.0.1.dev1
May 21, 2025
7.0.0
May 20, 2025
7.0.0.dev3
May 16, 2025
7.0.0.dev2
May 15, 2025
7.0.0.dev1
May 15, 2025
6.0.3.dev1
May 21, 2025
6.0.2
Mar 13, 2025
6.0.2.dev1
Mar 13, 2025
6.0.1
Feb 10, 2025
6.0.1.dev1
Feb 10, 2025
6.0.0
Feb 07, 2025
6.0.0rc2
Oct 22, 2024
6.0.0rc1
Oct 21, 2024
6.0.0.dev9
Feb 03, 2025
6.0.0.dev8
Jan 31, 2025
6.0.0.dev7
Jan 30, 2025
6.0.0.dev6
Dec 17, 2024
6.0.0.dev5
Dec 17, 2024
6.0.0.dev4
Dec 13, 2024
6.0.0.dev3
Oct 25, 2024
6.0.0.dev2
Oct 25, 2024
6.0.0.dev1
Oct 18, 2024
5.4.2
Dec 09, 2024
5.4.1
Nov 26, 2024
5.4.0
Nov 13, 2024
5.4.0.dev5
Nov 13, 2024
5.4.0.dev4
Oct 25, 2024
5.4.0.dev3
Oct 25, 2024
5.4.0.dev2
Oct 25, 2024
5.4.0.dev1
Oct 22, 2024
5.3.1
Sep 19, 2024
5.3.0
Sep 18, 2024
5.2.0
Sep 17, 2024
5.2.0.dev10
Sep 17, 2024
5.2.0.dev9
Sep 17, 2024
5.2.0.dev8
Sep 17, 2024
5.2.0.dev7
Sep 09, 2024
5.2.0.dev6
Sep 06, 2024
5.2.0.dev5
Sep 05, 2024
5.2.0.dev4
Sep 05, 2024
5.2.0.dev3
Sep 05, 2024
5.2.0.dev2
Aug 30, 2024
5.2.0.dev1
Aug 30, 2024
5.2.0.dev0
Aug 30, 2024
5.1.0
Aug 29, 2024
5.1.0rc1
Aug 28, 2024
5.1.0.dev1
Aug 29, 2024
5.0.1
Aug 12, 2024
5.0.0
Jul 31, 2024
4.1.2
Jul 31, 2024
4.1.1
Jul 31, 2024
4.1.0
Jul 31, 2024
4.0.0
May 03, 2024
3.2.2
Jul 31, 2024
3.2.1
Jul 31, 2024
3.2.0
Jul 31, 2024
3.1.0
Jul 31, 2024
3.0.3
Jul 31, 2024
3.0.2
Jul 31, 2024
3.0.1
Jul 31, 2024
3.0.0
Jul 31, 2024
2.2.4
Jul 31, 2024
2.2.3
Jul 31, 2024
2.2.2
Jul 31, 2024
Wheel compatibility matrix
Files in release
pinecone-9.0.1-cp310-abi3-macosx_10_12_x86_64.whl (2.6MiB)
pinecone-9.0.1-cp310-abi3-macosx_11_0_arm64.whl (2.6MiB)
pinecone-9.0.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.9MiB)
pinecone-9.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9MiB)
pinecone-9.0.1-cp310-abi3-musllinux_1_2_aarch64.whl (3.0MiB)
pinecone-9.0.1-cp310-abi3-musllinux_1_2_x86_64.whl (3.1MiB)
pinecone-9.0.1-cp310-abi3-win_amd64.whl (2.5MiB)
pinecone-9.0.1.tar.gz (262.1KiB)