Module 'langchain.vectorstores.pinecone' has no attribute 'init'

Hi All,

When I attempted to install ‘pinecone’ I received the error “could not find a version that satisfies the requirement pinecone”

So instead, I installed pinecone-client

Here is my code:

from langchain.vectorstores import pinecone
pinecone.init(api_key=“API_KEY”, environment=“asia-northeast1-gcp”)

I receive the following error:

File “C:\Users\Luke\PycharmProjects\Langchainv1\Langchain_Pinecone.py”, line 2, in
pinecone.init(api_key=“API_KEY”, environment=“asia-northeast1-gcp”)
AttributeError: module ‘langchain.vectorstores.pinecone’ has no attribute ‘init’

Does this error have anything to do with the fact that I was unable to install pinecone but installed pinecone-client? That doesnt appear to be the case using Pinecones documentation: https://docs.pinecone.io/docs/python-client

I appreciate any help. I have reinstalled pinecone-client and am a bit stumped.

1 Like

Hey, pinecone-client is the correct install — the issue is that you’re importing pinecone via LangChain, but what you’re doing is specific to the pinecone client. To do what you’re doing here you’d do:

import pinecone  # this is pinecone-client package

pinecone.init(api_key='...', environment='...')

I’d recommend this guide for using LangChain and Pinecone together, I hope that helps!