Getting SSLCertVerificationError when usting 001_getting_started.ipynb #1154
Unanswered
Palettenbrett
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey i just starting using anomalib for a project.
Im making my way through the how to get started section when i encountert this error:
SSLCertVerificationError Traceback (most recent call last)
File c:\Users\PaulR.conda\envs\anomalib_env\lib\urllib\request.py:1354, in AbstractHTTPHandler.do_open(self, http_class, req, **http_conn_args)
1353 try:
-> 1354 h.request(req.get_method(), req.selector, req.data, headers,
1355 encode_chunked=req.has_header('Transfer-encoding'))
1356 except OSError as err: # timeout error
File c:\Users\PaulR.conda\envs\anomalib_env\lib\http\client.py:1256, in HTTPConnection.request(self, method, url, body, headers, encode_chunked)
1255 """Send a complete request to the server."""
-> 1256 self._send_request(method, url, body, headers, encode_chunked)
File c:\Users\PaulR.conda\envs\anomalib_env\lib\http\client.py:1302, in HTTPConnection._send_request(self, method, url, body, headers, encode_chunked)
1301 body = _encode(body, 'body')
-> 1302 self.endheaders(body, encode_chunked=encode_chunked)
File c:\Users\PaulR.conda\envs\anomalib_env\lib\http\client.py:1251, in HTTPConnection.endheaders(self, message_body, encode_chunked)
1250 raise CannotSendHeader()
-> 1251 self._send_output(message_body, encode_chunked=encode_chunked)
File c:\Users\PaulR.conda\envs\anomalib_env\lib\http\client.py:1011, in HTTPConnection._send_output(self, message_body, encode_chunked)
1010 del self._buffer[:]
-> 1011 self.send(msg)
1013 if message_body is not None:
1014
1015 # create a consistent interface to message_body
File c:\Users\PaulR.conda\envs\anomalib_env\lib\http\client.py:951, in HTTPConnection.send(self, data)
950 if self.auto_open:
--> 951 self.connect()
952 else:
File c:\Users\PaulR.conda\envs\anomalib_env\lib\http\client.py:1425, in HTTPSConnection.connect(self)
1423 server_hostname = self.host
-> 1425 self.sock = self._context.wrap_socket(self.sock,
1426 server_hostname=server_hostname)
File c:\Users\PaulR.conda\envs\anomalib_env\lib\ssl.py:500, in SSLContext.wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
494 def wrap_socket(self, sock, server_side=False,
495 do_handshake_on_connect=True,
496 suppress_ragged_eofs=True,
497 server_hostname=None, session=None):
498 # SSLSocket class handles server_hostname encoding before it calls
499 # ctx._wrap_socket()
--> 500 return self.sslsocket_class._create(
501 sock=sock,
502 server_side=server_side,
503 do_handshake_on_connect=do_handshake_on_connect,
504 suppress_ragged_eofs=suppress_ragged_eofs,
505 server_hostname=server_hostname,
506 context=self,
507 session=session
508 )
File c:\Users\PaulR.conda\envs\anomalib_env\lib\ssl.py:1040, in SSLSocket._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):
File c:\Users\PaulR.conda\envs\anomalib_env\lib\ssl.py:1309, in SSLSocket.do_handshake(self, block)
1308 self.settimeout(None)
-> 1309 self._sslobj.do_handshake()
1310 finally:
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)
During handling of the above exception, another exception occurred:
URLError Traceback (most recent call last)
Cell In[7], line 2
1 datamodule = get_datamodule(config)
----> 2 datamodule.prepare_data() # Downloads the dataset if it's not in the specified
root
directory3 datamodule.setup() # Create train/val/test/prediction sets.
5 i, data = next(enumerate(datamodule.val_dataloader()))
File c:\Users\PaulR.conda\envs\anomalib_env\lib\site-packages\anomalib\data\mvtec.py:284, in MVTec.prepare_data(self)
282 logger.info("Found the dataset.")
283 else:
--> 284 download_and_extract(self.root, DOWNLOAD_INFO)
File c:\Users\PaulR.conda\envs\anomalib_env\lib\site-packages\anomalib\data\utils\download.py:263, in download_and_extract(root, info)
261 logger.info("Downloading the %s dataset.", info.name)
262 with DownloadProgressBar(unit="B", unit_scale=True, miniters=1, desc=info.name) as progress_bar:
--> 263 urlretrieve( # nosec - suppress bandit warning (urls are hardcoded)
264 url=f"{info.url}",
265 filename=downloaded_file_path,
266 reporthook=progress_bar.update_to,
267 )
268 logger.info("Checking the hash of the downloaded file.")
269 hash_check(downloaded_file_path, info.hash)
File c:\Users\PaulR.conda\envs\anomalib_env\lib\urllib\request.py:247, in urlretrieve(url, filename, reporthook, data)
230 """
231 Retrieve a URL into a temporary location on disk.
232
(...)
243 data file as well as the resulting HTTPMessage object.
244 """
245 url_type, path = _splittype(url)
--> 247 with contextlib.closing(urlopen(url, data)) as fp:
248 headers = fp.info()
250 # Just return the local path and the "headers" for file://
251 # URLs. No sense in performing a copy unless requested.
File c:\Users\PaulR.conda\envs\anomalib_env\lib\urllib\request.py:222, in urlopen(url, data, timeout, cafile, capath, cadefault, context)
220 else:
221 opener = _opener
--> 222 return opener.open(url, data, timeout)
File c:\Users\PaulR.conda\envs\anomalib_env\lib\urllib\request.py:525, in OpenerDirector.open(self, fullurl, data, timeout)
522 req = meth(req)
524 sys.audit('urllib.Request', req.full_url, req.data, req.headers, req.get_method())
--> 525 response = self._open(req, data)
527 # post-process response
528 meth_name = protocol+"_response"
File c:\Users\PaulR.conda\envs\anomalib_env\lib\urllib\request.py:542, in OpenerDirector._open(self, req, data)
539 return result
541 protocol = req.type
--> 542 result = self._call_chain(self.handle_open, protocol, protocol +
543 '_open', req)
544 if result:
545 return result
File c:\Users\PaulR.conda\envs\anomalib_env\lib\urllib\request.py:502, in OpenerDirector._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
File c:\Users\PaulR.conda\envs\anomalib_env\lib\urllib\request.py:1397, in HTTPSHandler.https_open(self, req)
1396 def https_open(self, req):
-> 1397 return self.do_open(http.client.HTTPSConnection, req,
1398 context=self._context, check_hostname=self._check_hostname)
File c:\Users\PaulR.conda\envs\anomalib_env\lib\urllib\request.py:1357, in AbstractHTTPHandler.do_open(self, http_class, req, **http_conn_args)
1354 h.request(req.get_method(), req.selector, req.data, headers,
1355 encode_chunked=req.has_header('Transfer-encoding'))
1356 except OSError as err: # timeout error
-> 1357 raise URLError(err)
1358 r = h.getresponse()
1359 except:
Does someone know why this is happening and how can i fix this?
Help would be much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions