FZJ-INM1-BDA / celldetection

Scalable Instance Segmentation using PyTorch & PyTorch Lightning.
https://docs.celldetection.org
Apache License 2.0
125 stars 21 forks source link

URLError with Cell Detection with Contour Proposal Networks: <urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:997)> #7

Open ugurdinc-icns opened 2 years ago

ugurdinc-icns commented 2 years ago

Cell Detection with Contour Proposal Networks notebook is somehow producing the following error, is it more about my own environment ?:

`SSLError Traceback (most recent call last) File ~/anaconda3/envs/trial_celldetect/lib/python3.10/urllib/request.py:1348, in AbstractHTTPHandler.do_open(self, http_class, req, **http_conn_args) 1347 try: -> 1348 h.request(req.get_method(), req.selector, req.data, headers, 1349 encode_chunked=req.has_header('Transfer-encoding')) 1350 except OSError as err: # timeout error

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/http/client.py:1282, in HTTPConnection.request(self, method, url, body, headers, encode_chunked) 1281 """Send a complete request to the server.""" -> 1282 self._send_request(method, url, body, headers, encode_chunked)

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/http/client.py:1328, in HTTPConnection._send_request(self, method, url, body, headers, encode_chunked) 1327 body = _encode(body, 'body') -> 1328 self.endheaders(body, encode_chunked=encode_chunked)

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/http/client.py:1277, in HTTPConnection.endheaders(self, message_body, encode_chunked) 1276 raise CannotSendHeader() -> 1277 self._send_output(message_body, encode_chunked=encode_chunked)

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/http/client.py:1037, in HTTPConnection._send_output(self, message_body, encode_chunked) 1036 del self._buffer[:] -> 1037 self.send(msg) 1039 if message_body is not None: 1040 1041 # create a consistent interface to message_body

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/http/client.py:975, in HTTPConnection.send(self, data) 974 if self.auto_open: --> 975 self.connect() 976 else:

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/http/client.py:1454, in HTTPSConnection.connect(self) 1452 server_hostname = self.host -> 1454 self.sock = self._context.wrap_socket(self.sock, 1455 server_hostname=server_hostname)

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/ssl.py:513, in SSLContext.wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session) 507 def wrap_socket(self, sock, server_side=False, 508 do_handshake_on_connect=True, 509 suppress_ragged_eofs=True, 510 server_hostname=None, session=None): 511 # SSLSocket class handles server_hostname encoding before it calls 512 # ctx._wrap_socket() --> 513 return self.sslsocket_class._create( 514 sock=sock, 515 server_side=server_side, 516 do_handshake_on_connect=do_handshake_on_connect, 517 suppress_ragged_eofs=suppress_ragged_eofs, 518 server_hostname=server_hostname, 519 context=self, 520 session=session 521 )

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/ssl.py:1071, in SSLSocket._create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session) 1070 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets") -> 1071 self.do_handshake() 1072 except (OSError, ValueError):

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/ssl.py:1342, in SSLSocket.do_handshake(self, block) 1341 self.settimeout(None) -> 1342 self._sslobj.do_handshake() 1343 finally:

SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:997)

During handling of the above exception, another exception occurred:

URLError Traceback (most recent call last) Cell In [14], line 1 ----> 1 train_bbbc039 = cd.data.BBBC039Train(conf.directory, download=conf.download_data) 2 val_bbbc039 = cd.data.BBBC039Val(conf.directory) 3 test_bbbc039 = cd.data.BBBC039Test(conf.directory)

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/site-packages/celldetection/data/datasets/bbbc039.py:93, in BBBC039Train.init(self, directory, download) 81 def init(self, directory, download=False): 82 """BBBC039 Train. 83 84 Training split of the BBBC039 dataset. (...) 91 download: Whether to download the dataset. 92 """ ---> 93 super().init(directory, download=download, mode='train')

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/site-packages/celldetection/data/datasets/bbbc039.py:58, in _BBBC039.init(self, directory, download, mode) 55 images_directory = join(directory, 'images') 57 if download: ---> 58 download_bbbc039(directory) 60 self.names = read_all(meta_directory, { 61 'train': 'training.txt', 62 'val': 'validation.txt', 63 'test': 'test.txt' 64 }[mode]) 66 self.images, self.masks, self.labels = load(images_directory, masks_directory, self.names)

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/site-packages/celldetection/data/datasets/bbbc039.py:46, in download_bbbc039(directory) 40 makedirs(directory, exist_ok=True) 41 for url in [ 42 'https://data.broadinstitute.org/bbbc/BBBC039/images.zip', 43 'https://data.broadinstitute.org/bbbc/BBBC039/metadata.zip', 44 'https://data.broadinstitute.org/bbbc/BBBC039/masks.zip' 45 ]: ---> 46 torchvision.datasets.utils.download_and_extract_archive(url, directory)

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/site-packages/torchvision/datasets/utils.py:446, in download_and_extract_archive(url, download_root, extract_root, filename, md5, remove_finished) 443 if not filename: 444 filename = os.path.basename(url) --> 446 download_url(url, download_root, filename, md5) 448 archive = os.path.join(download_root, filename) 449 print(f"Extracting {archive} to {extract_root}")

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/site-packages/torchvision/datasets/utils.py:146, in download_url(url, root, filename, md5, max_redirect_hops) 143 _download_file_from_remote_location(fpath, url) 144 else: 145 # expand redirect chain if needed --> 146 url = _get_redirect_url(url, max_hops=max_redirect_hops) 148 # check if file is located on Google Drive 149 file_id = _get_google_drive_file_id(url)

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/site-packages/torchvision/datasets/utils.py:94, in _get_redirect_url(url, max_hops) 91 headers = {"Method": "HEAD", "User-Agent": USERAGENT} 93 for in range(max_hops + 1): ---> 94 with urllib.request.urlopen(urllib.request.Request(url, headers=headers)) as response: 95 if response.url == url or response.url is None: 96 return url

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/urllib/request.py:216, in urlopen(url, data, timeout, cafile, capath, cadefault, context) 214 else: 215 opener = _opener --> 216 return opener.open(url, data, timeout)

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/urllib/request.py:519, in OpenerDirector.open(self, fullurl, data, timeout) 516 req = meth(req) 518 sys.audit('urllib.Request', req.full_url, req.data, req.headers, req.get_method()) --> 519 response = self._open(req, data) 521 # post-process response 522 meth_name = protocol+"_response"

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/urllib/request.py:536, in OpenerDirector._open(self, req, data) 533 return result 535 protocol = req.type --> 536 result = self._call_chain(self.handle_open, protocol, protocol + 537 '_open', req) 538 if result: 539 return result

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/urllib/request.py:496, in OpenerDirector._call_chain(self, chain, kind, meth_name, args) 494 for handler in handlers: 495 func = getattr(handler, meth_name) --> 496 result = func(args) 497 if result is not None: 498 return result

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/urllib/request.py:1391, in HTTPSHandler.https_open(self, req) 1390 def https_open(self, req): -> 1391 return self.do_open(http.client.HTTPSConnection, req, 1392 context=self._context, check_hostname=self._check_hostname)

File ~/anaconda3/envs/trial_celldetect/lib/python3.10/urllib/request.py:1351, in AbstractHTTPHandler.do_open(self, http_class, req, **http_conn_args) 1348 h.request(req.get_method(), req.selector, req.data, headers, 1349 encode_chunked=req.has_header('Transfer-encoding')) 1350 except OSError as err: # timeout error -> 1351 raise URLError(err) 1352 r = h.getresponse() 1353 except:

URLError: <urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:997)>`