Install & Compatibility
Where this runs
tested against v6.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
46MB installed
● package 46MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Pinecone
✓ from pinecone import Pinecone
✗ from pinecone import Pinecone
This quickstart demonstrates how to initialize the **new** `pinecone` client, create a serverless index, upsert vectors, and query the index. It is crucial to use the `pinecone` package for all new development as `pinecone-client` is deprecated. Replace `YOUR_API_KEY` with your actual Pinecone API key and adjust the dimension and region as needed.
import os
from pinecone import Pinecone, ServerlessSpec, CloudProvider, AwsRegion
# Initialize the Pinecone client (using the new 'pinecone' package)
api_key = os.environ.get('PINECONE_API_KEY', 'YOUR_API_KEY')
# Ensure you have a Pinecone API Key set as an environment variable or replace 'YOUR_API_KEY'
pc = Pinecone(api_key=api_key)
index_name = 'my-first-index'
dimension = 1536 # Example dimension, choose based on your embedding model
# Create a serverless index (if it doesn't exist)
if index_name not in pc.list_indexes().names():
pc.create_index(
name=index_name,
dimension=dimension,
metric='cosine', # or 'euclidean', 'dotproduct'
spec=ServerlessSpec(
cloud=CloudProvider.AWS,
region=AwsRegion.US_EAST_1
)
)
print(f"Index '{index_name}' created or already exists.")
# Connect to the index
index = pc.Index(name=index_name)
# Example: Upserting data (replace with your actual vectors/text)
vectors_to_upsert = [
{"id": "vec1", "values": [0.1]*dimension, "metadata": {"genre": "fiction"}},
{"id": "vec2", "values": [0.2]*dimension, "metadata": {"genre": "non-fiction"}}
]
index.upsert(vectors=vectors_to_upsert)
print(f"Upserted {len(vectors_to_upsert)} vectors to '{index_name}'.")
# Example: Querying the index
query_vector = [0.15]*dimension
query_results = index.query(vector=query_vector, top_k=1, include_metadata=True)
print("Query results:", query_results)
# Example: Deleting the index (uncomment to run)
# pc.delete_index(index_name)
# print(f"Index '{index_name}' deleted.")
Debug
Known issues
breakingThe `pinecone-client` package is DEPRECATED. The official Python client has been renamed to `pinecone`. Continuing to use `pinecone-client` will result in no further updates, bug fixes, or new features, and may lead to conflicts if both packages are installed.fixUninstall `pinecone-client` and install the new package: `pip uninstall pinecone-client && pip install pinecone`. Update import statements from `import pinecone` to `from pinecone import Pinecone` and instantiate the client `pc = Pinecone(...)` instead of `pinecone.init(...)`.
affects: All versions of `pinecone-client` (especially v6.0.0 and earlier)
breakingThe `pinecone.init()` function is no longer available in the new `pinecone` package (and was deprecated in later `pinecone-client` versions). Attempts to call it will result in an `AttributeError`.fixMigrate to the class-based initialization: `from pinecone import Pinecone; pc = Pinecone(api_key='YOUR_API_KEY')`.
affects: All versions of the `pinecone` package, and `pinecone-client` versions where deprecation warnings were issued.
breakingThe Python compatibility has changed. While `pinecone-client` supported Python 3.9+, the new `pinecone` SDK officially requires Python 3.10 or greater.fixUpgrade your Python environment to 3.10 or later before migrating to the `pinecone` package.
affects: Users of Python 3.9 with `pinecone-client` who are migrating to the new `pinecone` package.
gotchaInstalling both `pinecone-client` and `pinecone` in the same environment can lead to confusing interactions and unexpected behavior.fixAlways uninstall `pinecone-client` completely before installing `pinecone`. Run `pip uninstall pinecone-client` first.
affects: All versions, when both packages are present.
deprecatedThe `openapi_config` parameter for client initialization was deprecated in `pinecone-client` v5.x and removed in favor of direct parameters such as `proxy_url`, `proxy_headers`, and `ssl_ca_certs`.fixPass proxy and SSL configuration directly as keyword arguments to the `Pinecone` constructor (e.g., `Pinecone(api_key=..., proxy_url='...')`).
affects: pinecone-client v5.x and later; new `pinecone` package does not use `openapi_config`.
Upgrade
Version history
6.0.0latest on PyPI · released Feb 21, 2025
Audit
Dependencies
pythonrequiredRequired Python version for the legacy client.
grpciooptionalOptional dependency for gRPC-based data operations, offering modest performance improvements.
protobufoptionalDependency for gRPC functionality (was updated to address security vulnerability in newer clients).