Resolving MaxRetryError

I’m getting the following error:MaxRetryError: HTTPSConnectionPool(host=‘XXX-XXX-x1cb565.svc.eu-west4-gcp.pinecone.io’, port=443): Max retries exceeded with url: /vectors/upsert (Caused by SSLError(SSLEOFError(8, ‘EOF occurred in violation of protocol (_ssl.c:2426)’)))

From running the following code:for i in range(0, len(df), batch_size):

set end position of batch

i_end = min(i+batch_size, len(df))

get batch of lines and IDs

ids_batch = df[‘itinerary_id’][i: i+batch_size]
country_batch = df[‘country’][i: i+batch_size]
country_code_batch = df[‘country_code’][i: i+batch_size]
weather_batch = df[‘weather’][i: i+batch_size]
ideal_days_batch = df[‘ideal_days’][i: i+batch_size]
itinerary_title_batch = df[‘title’][i: i+batch_size]
price_cents_batch = df[‘price_cents’][i: i+batch_size]
price_currency_batch = df[‘price_currency’][i: i+batch_size]
days_batch = df[‘days’][i: i+batch_size]
embeddings_batch = df[‘embeddings’][i: i+batch_size]

embeddings = [e.tolist() for e in embeddings_batch]

metadata = [{
‘country’: country,
‘country_code’: country_code,
‘weather’: weather,
‘ideal_days’: ideal_days,
‘itinerary_title’: itinerary_title,
‘price_cents’: price_cents,
‘price_currency’: price_currency,
‘days’: days
} for country, country_code, weather, ideal_days, itinerary_title, price_cents, price_currency, days in zip(country_batch, country_code_batch, weather_batch, ideal_days_batch, itinerary_title_batch, price_cents_batch, price_currency_batch, days_batch)]

upsert batch

to_upsert = zip(ids_batch, embeddings_batch, metadata)
index.upsert(list(to_upsert))Please help me resolve this.

The above script was working fine for the past few days and now it’s not anymore.

1 Like

I have same issue with this code.

batch_size = 128

Calculate the number of batches

num_batches = (len(data) // batch_size) + 1

Iterate over batches

for batch in tqdm(range(num_batches)):
start_index = batch * batch_size
end_index = min((batch + 1) * batch_size, len(data))

ids = data['id'].iloc[start_index:end_index].values
xc = data["values"].iloc[start_index:end_index].values
metadatas = data.metadata.iloc[start_index:end_index].values

# create records list for upsert
records = zip(ids, xc, metadatas)

# upsert to Pinecone
index.upsert(vectors=records)

Have you found a fix ?