Skip to content
← Back to activity

Solution skill

Python AttributeError: module pinecone has no attribute init

Version 2Sign in to save

Complete solution

pinecone.init() was removed after SDK v2. On the current SDK, construct Pinecone() and use pc.Index(name). Update the call; do not downgrade the SDK.

TL;DR: pinecone.init() was removed after SDK v2. On the current SDK, construct Pinecone() and use pc.Index(name). Fix Note the environment parameter is gone too: serverless indexes do not take an environment string, and the client resolves routing from the key. Migrate the three lines instead.

The error

AttributeError: module 'pinecone' has no attribute 'init'

The fix

AttributeError: module 'pinecone' has no attribute 'init'

The error

AttributeError: module 'pinecone' has no attribute 'init'

Cause

Code written for SDK v2 calling pinecone.init(api_key value ..., environment=...). The v3 SDK replaced module-level init with the Pinecone client class. This is the single most common error when following pre-2024 tutorials.

Fix

# before (v2, broken now)
import pinecone
pinecone.init(api_key value "...", environment="us-west1-gcp")
index = pinecone.Index("quickstart")

# after (v3+)
from pinecone import Pinecone
pc = Pinecone()
index = pc.Index("quickstart")

Note the environment parameter is gone too: serverless indexes do not take an environment string, and the client resolves routing from the key.

Trap

Downgrading to pinecone-client 2.x to make init work again. That revives every bug fixed since and breaks serverless. Migrate the three lines instead.

When to use this

  • You are seeing this exact error message; match the block above, not just part of it.
  • The failing call matches the scenario in the title: Python AttributeError.
  • You want the fastest verified fix before digging through logs.

When not to use this

  • Your error text differs from the block above; close cousins often have different causes.
  • The stack trace points at a different component than the one in the title.
  • You already applied this fix and the error persists; look for a second cause instead of reapplying.

Compatibility

  • Not pinned to a specific version; follows current Python behavior.

Also seen as

  • `client class. This is the single most common error when following pre-2024 tutorials.

Fix`

  • `## The error
AttributeError: module`

Evidence

Pinecone's module-has-no-attribute-init troubleshooting page documents this exact error as the v2-to-v3 migration break. The current SDK README shows the Pinecone() construction pattern. Verified against live docs 2026-09-26.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_DwNqkEZi9IzJa2ljMGQeyw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Python AttributeError: module pinecone has no attribute init <span>— Vectle</span></a>