I am following the Pinecone API and I received this error message:
Traceback (most recent call last):
File "/Users/leonardjin/Dev/lodge/openAI/collegeAssistant/academicAssisstants/apush/embeddings/embeddings_test.py", line 57, in <module>
pinecone.init(
^^^^^^^^^^^^^
AttributeError: module 'pinecone' has no attribute 'init'
Here is an excerpt of my code:
import pinecone
index_name = 'langchain-retrieval-augmentation'
pinecone.init(
api_key="----------------------------, # find api key in console at app.pinecone.io
environment='us-west1-gcp' # find next to api key in console
)
if index_name not in pinecone.list_indexes():
# we create a new index
pinecone.create_index(
name=index_name,
metric='dotproduct',
dimension=len(res[0]) # 1536 dim of text-embedding-ada-002
)
#Connect to index (current 'total_vector_count' is 0)
index = pinecone.GRPCIndex(index_name)
index.describe_index_stats()
I installed: pip3 install "pinecone-client[grpc]" but it did not solve this error
My code ran successfully before, but it started to give me this error:
AttributeError: module 'pinecone' has no attribute 'init'
I did multiple Google searches and tried everything, but I am still not sure why I got this error. I would really appreciate some help, thanks
I got the same error and I solved it by using the
pinecone.Pinecone()method.Use this instead of using
pinecone.init():