Quickstart (Python)

You are viewing docs for Pinecone v1. Switch to docs Pinecone v2.

Pinecone offers similarity search as a service. To get started, get an API key then come back here and get a production-ready similarity search service up and running in minutes.

Install Pinecone

Install Pinecone in the terminal:

pip install -U pinecone-client

Install Pinecone in a Jupyter notebook:

!pip install -U pinecone-client

Tip: Pinecone is tested on Python 3.6+. We strongly recommend installing Pinecone in a virtual environment; it’s good for Python hygiene. Start using Python virtual environments with one of these guides: 1, 2.

Verify Your Pinecone API Key

Let’s make sure your Pinecone API key works.

import pinecone


pinecone.list_indexes()  # list your Pinecone indexes

Hello, Pinecone!

Open Notebook

import pinecone
import pandas as pd


# Create an index
pinecone.create_index("hello-pinecone-index", metric="euclidean")

# Connect to the index
index = pinecone.Index("hello-pinecone-index")

# Generate some data
df = pd.DataFrame(data={
    "id": ["A", "B", "C", "D", "E"],
    "vector": [[1]*2, [2]*2, [3]*2, [4]*2, [5]*2]

# Insert the data
index.upsert(items=zip(df.id, df.vector))

# Query the index and get similar vectors
index.query(queries=[[0, 1]], top_k=3)

# Get index info

# Delete the index

What will you build?

Upgrade your search or recommendation systems with just a few lines of code, or contact us for help.