malllabiisc/WordGCN

SSLError: Certificate verify failed

loginaway opened this issue · 1 comments

Hi,
Nice paper!

I had some problem during running 'semgcn.py'.
I downloaded pretrained 300-dimensional SynGCN embeddings from your README.md, and tried to fine tune them using semgcn.py. Here is how I typed:
sudo python3 semgcn.py -embed ./embeddings/syngcn_embeddings.txt -semantic synonyms -embed_dim 300 -name fine_tuned_embeddings -gpu 0

However, after the percentile hit 100, some Error occurred:

2019-09-20 19:57:05,665 - [INFO] - E:0 (Sents: 64640/64640 [100.0]): Train Loss0.36636	fine_tuned_embeddings_20_09_2019_19:44:56	0.0

Traceback (most recent call last):
  File "/usr/lib/python3.5/urllib/request.py", line 1254, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "/usr/lib/python3.5/http/client.py", line 1122, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.5/http/client.py", line 1167, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.5/http/client.py", line 1118, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.5/http/client.py", line 944, in _send_output
    self.send(msg)
  File "/usr/lib/python3.5/http/client.py", line 887, in send
    self.connect()
  File "/usr/lib/python3.5/http/client.py", line 1276, in connect
    server_hostname=server_hostname)
  File "/usr/lib/python3.5/ssl.py", line 377, in wrap_socket
    _context=self)
  File "/usr/lib/python3.5/ssl.py", line 752, in __init__
    self.do_handshake()
  File "/usr/lib/python3.5/ssl.py", line 988, in do_handshake
    self._sslobj.do_handshake()
  File "/usr/lib/python3.5/ssl.py", line 633, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "semgcn.py", line 613, in <module>
    model.fit(sess)
  File "semgcn.py", line 567, in fit
    self.checkpoint(train_loss, epoch, sess)
  File "semgcn.py", line 494, in checkpoint
    results		= evaluate_on_all(embedding)
  File "/usr/local/lib/python3.5/dist-packages/web-0.0.1-py3.5.egg/web/evaluate.py", line 370, in evaluate_on_all
    "TR9856": fetch_TR9856(),
  File "/usr/local/lib/python3.5/dist-packages/web-0.0.1-py3.5.egg/web/datasets/similarity.py", line 335, in fetch_TR9856
    'similarity', uncompress=True, verbose=0),
  File "/usr/local/lib/python3.5/dist-packages/web-0.0.1-py3.5.egg/web/datasets/utils.py", line 741, in _fetch_file
    handlers=handlers)
  File "/usr/local/lib/python3.5/dist-packages/web-0.0.1-py3.5.egg/web/datasets/utils.py", line 648, in _fetch_helper
    data = url_opener.open(request)
  File "/usr/lib/python3.5/urllib/request.py", line 466, in open
    response = self._open(req, data)
  File "/usr/lib/python3.5/urllib/request.py", line 484, in _open
    '_open', req)
  File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 1297, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.5/urllib/request.py", line 1256, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)>

I'm sure that my Ubuntu is properly connected to the Internet. So why does this happen?

Thanks!

Problem solved.
Apparently I didn't google this problem lol : )

I add two lines to the front of semgcn.py, and I guess it will also help if I add them to the front of syngcn.py.

import ssl
ssl._create_default_https_context = ssl._create_unverified_context