hey @bhavyahoda,
can you briefly tell what actually the problem are you facing in loading the dataset ?
Doubt regarding dataset
in the line
sns.load_dataset(“tips”) I am getting an error
means I am not able to import the dataset using this thing whereas in the video bhaiya has done this only why is it so
what error particularly does it shows?
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)
1316 try:
-> 1317 h.request(req.get_method(), req.selector, req.data, headers,
1318 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)
1229 “”“Send a complete request to the server.”""
-> 1230 self._send_request(method, url, body, headers, encode_chunked)
1231
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
1275 body = _encode(body, ‘body’)
-> 1276 self.endheaders(body, encode_chunked=encode_chunked)
1277
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in endheaders(self, message_body, encode_chunked)
1224 raise CannotSendHeader()
-> 1225 self._send_output(message_body, encode_chunked=encode_chunked)
1226
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in _send_output(self, message_body, encode_chunked)
1003 del self._buffer[:]
-> 1004 self.send(msg)
1005
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in send(self, data)
943 if self.auto_open:
–> 944 self.connect()
945 else:
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in connect(self)
1398
-> 1399 self.sock = self._context.wrap_socket(self.sock,
1400 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:1108)
During handling of the above exception, another exception occurred:
URLError Traceback (most recent call last)
in
----> 1 sns.load_dataset(“tips”)
~/Desktop/ml-env/lib/python3.8/site-packages/seaborn/utils.py in load_dataset(name, cache, data_home, **kws)
447 os.path.basename(full_path))
448 if not os.path.exists(cache_path):
–> 449 urlretrieve(full_path, cache_path)
450 full_path = cache_path
451
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in urlretrieve(url, filename, reporthook, data)
245 url_type, path = _splittype(url)
246
–> 247 with contextlib.closing(urlopen(url, data)) as fp:
248 headers = fp.info()
249
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
220 else:
221 opener = _opener
–> 222 return opener.open(url, data, timeout)
223
224 def install_opener(opener):
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in open(self, fullurl, data, timeout)
523
524 sys.audit(‘urllib.Request’, req.full_url, req.data, req.headers, req.get_method())
–> 525 response = self._open(req, data)
526
527 # post-process response
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in _open(self, req, data)
540
541 protocol = req.type
–> 542 result = self._call_chain(self.handle_open, protocol, protocol +
543 ‘_open’, req)
544 if result:
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
500 for handler in handlers:
501 func = getattr(handler, meth_name)
–> 502 result = func(*args)
503 if result is not None:
504 return result
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in https_open(self, req)
1358
1359 def https_open(self, req):
-> 1360 return self.do_open(http.client.HTTPSConnection, req,
1361 context=self._context, check_hostname=self._check_hostname)
1362
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1318 encode_chunked=req.has_header(‘Transfer-encoding’))
1319 except OSError as err: # timeout error
-> 1320 raise URLError(err)
1321 r = h.getresponse()
1322 except:
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)>
hey @bhavyahoda ,
kindly let me know these things :
- What machine are you working on?means windows ,linux,etc.
- Do you have proper internet?
- Kindly confirm that ssl module is installed in your system.
- Python version you are using.
I am working on Macos X
yes I have proper internet
python 3.8
but I do not know about ssl module what is it?
I have tried reinstalling seaborn also but still stuck up
can u tell me how to remove this ssl certification error
try running this
import ssl
import urllib2
ssl._create_default_https_context = ssl._create_unverified_context
and after this your code
let me know the output of this
ModuleNotFoundError Traceback (most recent call last)
in
1 import seaborn as sns
2 import ssl
----> 3 import urllib2
4 #ssl._create_default_https_context = ssl._create_unverified_context
ModuleNotFoundError: No module named ‘urllib2’
okaay , just remove that line for now.
only use
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
do you have urllib3 installed ,
check this by
import urllib3
yeah now I am able to do so but what was the problem can u pls explain
so is it properly loading dataset now?
no I do not have urllib3 also
yes
it is loading the dataset properly
I have printed the dataset also.
Kindly install it , it will useful in future with other packages
yeah I have downloaded it now
thanks for ur support
So the error , was about a SSL certificate , which is something like preparing a secured connection to download something , which seaborn makes. But due to some reasons ,it wasn’t able to do so. Hence you were getting this error.
Glad to hear this.
I would request you to kindly mark this doubt as resolved and also provide you valuable feedback as as it helps us to improve this platform and provide you with better learning experience.
Thank You and Happy Learning .