Closed yogeshriyat closed 3 years ago
This is the entire traceback
`--------------------------------------------------------------------------- SSLCertVerificationError Traceback (most recent call last) /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in do_open(self, http_class, req, **http_conn_args) 1349 try: -> 1350 h.request(req.get_method(), req.selector, req.data, headers, 1351 encode_chunked=req.has_header('Transfer-encoding'))
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in request(self, method, url, body, headers, encode_chunked) 1254 """Send a complete request to the server.""" -> 1255 self._send_request(method, url, body, headers, encode_chunked) 1256
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in _send_request(self, method, url, body, headers, encode_chunked) 1300 body = _encode(body, 'body') -> 1301 self.endheaders(body, encode_chunked=encode_chunked) 1302
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in endheaders(self, message_body, encode_chunked) 1249 raise CannotSendHeader() -> 1250 self._send_output(message_body, encode_chunked=encode_chunked) 1251
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in _send_output(self, message_body, encode_chunked) 1009 del self._buffer[:] -> 1010 self.send(msg) 1011
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in send(self, data) 949 if self.auto_open: --> 950 self.connect() 951 else:
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in connect(self) 1423 -> 1424 self.sock = self._context.wrap_socket(self.sock, 1425 server_hostname=server_hostname)
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session) 499 # ctx._wrap_socket() --> 500 return self.sslsocket_class._create( 501 sock=sock,
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session) 1039 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets") -> 1040 self.do_handshake() 1041 except (OSError, ValueError):
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py in do_handshake(self, block) 1308 self.settimeout(None) -> 1309 self._sslobj.do_handshake() 1310 finally:
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)
During handling of the above exception, another exception occurred:
URLError Traceback (most recent call last)
Thanks for your question.
Generally, when people have SSL issues when using Python on MacOSX, it's due to a missing step when installing Python: installing the SSL certificates. You need to run this script (change the Python version to match the version you installed) :
/Applications/Python\ 3.7/Install\ Certificates.command
Hope this helps.
Note: if you installed Python using MacPorts, open a terminal and run sudo port install curl-ca-bundle
.
Since this is quite a frequent question, so I added it to the new FAQ section on the project's home page.
I'm closing this issue, but please reopen if the problem persists after installing the SSL certificates.
When I use this line of code for the fetch_housing_data function:
DOWNLOAD_ROOT = "https://raw.githubusercontent.com/ageron/handson-ml2/master/"
I get the following error:
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)>
I also tried this path which generated the same error:
https://raw.githubusercontent.com/ageron/handson-ml2/master/datasets/housing/housing.tgz
Any ideas?
Sorry if this was answered before. I tried doing a search, but couldn't find an answer to this issue.