Replies: 7 comments 2 replies
-
🤖 Hello again, @ashiwalv! Great to see you back and diving deeper into LangChain. Let's get you past this hurdle. The error you're encountering is related to SSL certificate verification. It seems like the Python requests library is unable to verify the SSL certificate of the server it's trying to connect to ( This issue can occur due to several reasons, such as:
Here are a few things you can try to resolve this issue:
If none of the above solutions work, it would be helpful if you could provide more information about your Python environment and network configuration. This could help in identifying the root cause of the issue. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
how do you fix the error? we cannot change the lib C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\langchainhub\client.py. how to add verify=False for requests? |
Beta Was this translation helpful? Give feedback.
-
Same here, my imports are:
I keep getting this exception:
|
Beta Was this translation helpful? Give feedback.
-
I am also getting same error for this code: from langchain import hub
prompt = hub.pull("rlm/rag-prompt") Error
|
Beta Was this translation helpful? Give feedback.
-
Same error here from langchain import hub
chat_prompt = hub.pull("langchain-ai/chat-langchain-rephrase")
|
Beta Was this translation helpful? Give feedback.
-
this worked for me to disable the ssl: import requests session = requests.Session() requests.sessions.Session = lambda: session obj = hub.pull("wfh/proposal-indexing") |
Beta Was this translation helpful? Give feedback.
-
Run the following command to resolve the SSL exception error . This was caused due to the certificate not updated in Python . pip3 install --upgrade certifi |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I am coding a RAG application with my already locally created FAISS vector database. Now, when I execute the above code, where I pass the vector database as a retriever along with my prompt, it goes into error.
Error logs:
`Traceback (most recent call last):
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 1099, in _validate_conn
conn.connect()
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 653, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 806, in ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\ssl.py", line 465, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\ssl.py", line 509, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 501, in wrap_socket
return self.sslsocket_class._create(
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1041, in _create
self.do_handshake()
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1310, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 793, in urlopen
response = self._make_request(
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 491, in _make_request
raise new_e
urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 486, in send
resp = conn.urlopen(
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 847, in urlopen
retries = retries.increment(
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\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='api.hub.langchain.com', port=443): Max retries exceeded with url: /commits/rlm/rag-prompt/?limit=100&offset=0 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Virendra\test_RAG.py", line 128, in
prompt = hub.pull("rlm/rag-prompt")
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\langchain\hub.py", line 80, in pull
resp: str = client.pull(owner_repo_commit)
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\langchainhub\client.py", line 251, in pull
commit_hash = self._get_latest_commit_hash(f"{owner}/{repo}")
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\langchainhub\client.py", line 176, in _get_latest_commit_hash
commits_resp = self.list_commits(repo_full_name)
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\langchainhub\client.py", line 150, in list_commits
res = requests.get(
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "C:\Users\Virendra\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.hub.langchain.com', port=443): Max retries exceeded with url: /commits/rlm/rag-prompt/?limit=100&offset=0 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))`
System Info
langchainhub = 0.1.14
langchain = 0.1.3
langchain-core = 0.1.17
langchain-community = 0.1.16
langchain-openai = 0.0.5
python = 3.11.0
Beta Was this translation helpful? Give feedback.
All reactions