Error of Haven't specified API key

I have written below code.

import pinecone
from pinecone import Pinecone

pc = Pinecone(api_key=“xxxxxxxxxxxxxxx”, region=“us-east-1”)
index = pc.Index(“xxxxx”)

from langchain_pinecone import PineconeVectorStore
docsearch = PineconeVectorStore.from_existing_index(index_name=“xxxxx”, embedding=model)
docs = docsearch.similarity_search(query, k=3)

But i got below error. I have the latest version of all libraries.
PineconeConfigurationError Traceback (most recent call last)
in <cell line: 3>()
1 from langchain_pinecone import PineconeVectorStore
2
----> 3 docsearch = PineconeVectorStore.from_existing_index(index_name=“pdfbot”, embedding=model)
4

4 frames
/usr/local/lib/python3.10/dist-packages/pinecone/config/config.py in build(api_key, host, proxy_url, proxy_headers, ssl_ca_certs, ssl_verify, additional_headers, **kwargs)
56
57 if not api_key:
—> 58 raise PineconeConfigurationError(“You haven’t specified an Api-Key.”)
59 if not host:
60 raise PineconeConfigurationError(“You haven’t specified a host.”)

PineconeConfigurationError: You haven’t specified an Api-Key.

@khush.patel ,

This error arises because LangChain cannot find the 'PINECONE_API_KEY' environment variable.

Please take a look at Initializing a vector store for guidance on how to set it.

Best,

Evan