Please help: AttributeError: list_indexes is no longer a top-level attribute of the pinecone package

pckey=pinecone.Pinecone(api_key=PINECONE_API_KEY)

index_name=‘’
index=pinecone.Index(api_key=pckey,index_name=index_name, host=)
docsearch=Pinecone.from_texts([t.page_content for t in text_chunks], embeddings, index_name=index_name)

When I try to execute the above code:
I get the error:

AttributeError Traceback (most recent call last)
Cell In[44], line 1
----> 1 docsearch=Pinecone.from_texts([t.page_content for t in text_chunks], embeddings, index_name=index_name)

290 except ImportError:
291     raise ValueError(
292         "Could not import pinecone python package. "
293         "Please install it with `pip install pinecone-client`."
294     )

→ 296 indexes = pinecone.list_indexes() # checks if provided index exists
298 if index_name in indexes:
299 index = pinecone.Index(index_name)

 40 def list_indexes(*args, **kwargs):
 41     example = """
 42     from pinecone import Pinecone
 43     

(…)
49 # do something
50 “”"

51 raise AttributeError(_build_class_migration_message(‘list_indexes’, example))

AttributeError: list_indexes is no longer a top-level attribute of the pinecone package.

To use list_indexes, please create a client instance and call the method there instead.

Example:

from pinecone import Pinecone

pc = Pinecone(api_key='YOUR_API_KEY')

index_name = "quickstart" # or your index name

if index_name not in pc.list_indexes().names():
    # do something

Hi @awstrial3007, thanks for your question. Based on the usage of from_texts in your code, it looks like you’re using a deprecated version of LangChain. Please upgrade your LangChain package and update your code to use the latest version.