Search code examples
pythonllama-indexpinecone

I get a Max retries exceeded (_ssl.c:2427) error when trying to inject with LlamaIndex data in a pinecone DB


I get a Max retries exceeded with url:

(Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2427)')))

When trying to inject data in pinecone DB When trying to inject data with LlamaIndex into a Pinecone DB i get the following error:


    LlamaIndex_Doc_Helper-JJYEcwwZ\Lib\site-packages\urllib3\util\retry.py", line 515, in increment
        raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='llamaindex-documentation-helper-ksad0bm.svc.gcp-starter.pinecone.io', port=443): Max retries exceeded with url: /vectors/upsert (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2427)')))
    Upserted vectors:   0%|          | 0/18 [00:02<?, ?it/s]

My Python code:

#--- Indexing in Pinecone
    # Init. Pinecone Index object
    index_name = "llamaindex-documentation-helper"
    pinecone_index = pinecone.Index(index_name=index_name)
    # Init. vector store object
    vector_store = PineconeVectorStore(pinecone_index=pinecone_index)
    # Init storage context
    storage_context = StorageContext.from_defaults(vector_store=vector_store)
    # Creates
    index = VectorStoreIndex.from_documents(
        documents=documents, # documents = dir_reader.load_data()
        storage_context=storage_context, # storage_context = StorageContext.from_defaults(vector_store=vector_store)
        service_context=service_context, # service_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model, node_parser=node_parser)
        show_progress=True,
    )

I disabled firewalls, VPN, and Antivirus programs I am using Windows 11 pro, Python version 3.12 in a pipenv and my pip install certifi --upgrade is up to date

I can also ping the server:

LlamaIndex Tutorial\LlamaIndex Doc Helper> ping llamaindex-documentation-helper-ksad0bm.svc.gcp-starter.pinecone.io

Pinging ingress.gcp-starter.pinecone.io [34.160.88.44] with 32 bytes of data:
Reply from 34.160.88.44: bytes=32 time=10ms TTL=114
Reply from 34.160.88.44: bytes=32 time=9ms TTL=114
Reply from 34.160.88.44: bytes=32 time=11ms TTL=114
Reply from 34.160.88.44: bytes=32 time=9ms TTL=114

Ping statistics for 34.160.88.44:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 9ms, Maximum = 11ms, Average = 9ms

Any comments on how to maybe fix the issue would be greatly appreciated


Solution

  • I found the source of the issue and resolved it. The following code line was the source of the error:

    index_name = "llamaindex-documentation-helper"
    

    The name of the index did not perfectly match the name of the index on my Picone account... Typos are monsters.

    My code lines below provide a way to check if the index name exists and wipes/resets the Pinecone database

    index_name = "llamaindex-oc-helper"
    # Checks if the picone DB exists
    if index_name not in pinecone.list_indexes():
        print("\n\033[96m The index name is not in the list of indexes associated with the provided Pinecone account.\n")
        # Hard exit
        exit()
    # Init. Pinecone Index object
    pinecone_index = pinecone.Index(index_name=index_name)
    # Warning! Wipes the pinecone DB
    pinecone_index.delete(delete_all=True)
    

    Better Replace

    if index_name not in pinecone.list_indexes():
        print("\n\033[96m The index name is not in the list of indexes associated with the provided Pinecone account.\n")
        # Hard exit
        exit()
    

    with

        if index_name not in pinecone.list_indexes():
            raise ValueError("The index name is not in the list of indexes associated with the provided Pinecone account.")