solc-select
solc-select copied to clipboard
SSL certificate verify failed
Ubuntu 18.04
When I use the command solo-select install
I met with this error:
Traceback (most recent call last):
File "/usr/local/bin/solc-select", line 11, in <module>
sys.exit(solc_select())
File "/usr/local/lib/python3.6/dist-packages/solc_select/__main__.py", line 48, in solc_select
for version in get_installable_versions():
File "/usr/local/lib/python3.6/dist-packages/solc_select/solc_select.py", line 105, in get_installable_versions
installable = list(set(get_available_versions()) - set(installed_versions()))
File "/usr/local/lib/python3.6/dist-packages/solc_select/solc_select.py", line 112, in get_available_versions
list_json = urllib.request.urlopen(url).read()
File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib/python3.6/urllib/request.py", line 1368, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/usr/lib/python3.6/urllib/request.py", line 1327, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)>
Hi @Kindhearted57, thanks for reporting this.
Can you provide the output of the following commands?
pip3 --version
curl -X GET -I https://binaries.soliditylang.org/linux-amd64/list.json
python3 -c 'import urllib.request; urllib.request.urlopen("https://binaries.soliditylang.org/linux-amd64/list.json")'
pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.8)
curl -X GET -I https://binaries.soliditylang.org/linux-amd64/list.json
HTTP/2 200
content-type: application/json
content-length: 36292
vary: Accept-Encoding
date: Thu, 15 Jul 2021 02:32:41 GMT
last-modified: Tue, 22 Jun 2021 13:39:42 GMT
etag: "6a7c5fc3f880c3a003e2b675ab561f53"
x-amz-version-id: oRX_6QasfoW4HIf23leZP0vvCf8hIBGs
accept-ranges: bytes
server: AmazonS3
x-cache: Miss from cloudfront
via: 1.1 c65fff2f82e54309af3d824113d9507d.cloudfront.net (CloudFront)
x-amz-cf-pop: HKG54-C1
x-amz-cf-id: CozDnf3k0CPguWKpFTvI3O6hu3gXEq7JWgpyp7cgHd5WCs0h8KvbLw==
python3 -c 'import urllib.request; urllib.request.urlopen("https://binaries.soliditylang.org/linux-amd64/list.json")'
Traceback (most recent call last):
File "/usr/lib/python3.8/urllib/request.py", line 1317, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/usr/lib/python3.8/http/client.py", line 1230, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1276, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1225, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1004, in _send_output
self.send(msg)
File "/usr/lib/python3.8/http/client.py", line 944, in send
self.connect()
File "/usr/lib/python3.8/http/client.py", line 1399, in connect
self.sock = self._context.wrap_socket(self.sock,
File "/usr/lib/python3.8/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/usr/lib/python3.8/ssl.py", line 1040, in _create
self.do_handshake()
File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.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:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.8/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/usr/lib/python3.8/urllib/request.py", line 1360, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "/usr/lib/python3.8/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)>
Hey @Kindhearted57, thanks for the output on the commands. I am having trouble reproducing this error locally. From the error message, it looks like your local certificates may be out of date. Are you experiencing this with any other requests that require ssl?
Perhaps, you could try retrieving fresh certificates? https://manpages.ubuntu.com/manpages/impish/en/man8/update-ca-certificates.8.html
Hey @NatalieChin80, Sorry for the late reply. I have been searching around, and it seems I am getting this error because I used a self-signed certificate. This stackoverflow question provides some work-arounds for this problem.
python3 -c 'import urllib.request;import ssl;ssl._create_default_https_context = ssl._create_unverified_context; urllib.request.urlopen("https://binaries.soliditylang.org/linux-amd64/list.json")'
and
python3 -c 'import urllib.request; urllib.request.urlopen("https://binaries.soliditylang.org/linux-amd64/list.json",cafile=certifi.where())'
work in my case, while update-ca-certificates
seems unable to solve it : (
Running on macOS 11 but the aforementioned stackoverflow question gave some clarity and after running
pip3 install certifi
/Applications/Python\ 3.8/Install\ Certificates.command
the command worked as expected.
Same issue in MacOS had to run the command above. Definitely should be part of main README!
Can we add this to the readme?
Hey @PatrickAlphaC, it's in the README here! :) https://github.com/crytic/solc-select#ssl-certificate_verify_failed-on-running-solc-select-commands-investigation-ongoing
Ah I missed it, thanks!