SSL Error - Max retries

I am getting the following error:

SSLError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/sentence-transformers/all-mpnet-base-v2 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1007)')))"), '(Request ID: 84099c2f-6397-481c-b8e6-4a4b042f69ca)')

Here is the code snippet:

from langchain.text_splitter import SentenceTransformersTokenTextSplitter
splitter = SentenceTransformersTokenTextSplitter(chunk_overlap=0)
text = "Lorem "

I am running windows machine on a company laptop. Using:
python 3.10.11
langchain 0.0.336
requests 2.31.0
huggingface-hub 0.20.2

I cannot use these solutions:
python 3.x - Facing SSL Error with Huggingface pretrained models - Stack Overflow

As I do not have sufficient privelages.

Please help.

I am facing the same issue. Unable to solve it with the Stackoverflow answers. Please let me know if you find a solution for this.

1 Like

Same question.

I solved that by reboot my computer, it might be network issue.

I was having the same SSL Certificate Verification Failed error when using HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")

Error Message:
SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain

To fix the problem, I downloaded the ROOT_CA on my company laptop (check how to do it in this reply, follow only step#1), exported it as a .pem file, and in the main() function of my python script, set the ‘CURL_CA_BUNDLE’ environment variable to the ROOT_CA.pem, as follows:

os.environ['CURL_CA_BUNDLE'] = /path/to/extracted/ROOT_CA.pem

PS: python 3.9.13, requests==2.32.3

1 Like