urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)>
goxofy opened this issue · 5 comments
$ nodeenv --list
Traceback (most recent call last):
File "/usr/local/lib/python3.8/urllib/request.py", line 1319, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/usr/local/lib/python3.8/http/client.py", line 1230, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1276, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1225, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1004, in _send_output
self.send(msg)
File "/usr/local/lib/python3.8/http/client.py", line 944, in send
self.connect()
File "/usr/local/lib/python3.8/http/client.py", line 1399, in connect
self.sock = self._context.wrap_socket(self.sock,
File "/usr/local/lib/python3.8/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/usr/local/lib/python3.8/ssl.py", line 1040, in _create
self.do_handshake()
File "/usr/local/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 "/home/tink/nodejs-apps/py-env/bin/nodeenv", line 8, in <module>
sys.exit(main())
File "/home/tink/nodejs-apps/py-env/lib/python3.8/site-packages/nodeenv.py", line 1093, in main
args.node = get_last_stable_node_version()
File "/home/tink/nodejs-apps/py-env/lib/python3.8/site-packages/nodeenv.py", line 1026, in get_last_stable_node_version
return _get_versions_json()[0]['version'].lstrip('v')
File "/home/tink/nodejs-apps/py-env/lib/python3.8/site-packages/nodeenv.py", line 1002, in _get_versions_json
response = urlopen('%s/index.json' % src_base_url)
File "/home/tink/nodejs-apps/py-env/lib/python3.8/site-packages/nodeenv.py", line 624, in urlopen
return urllib2.urlopen(req)
File "/usr/local/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python3.8/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/local/lib/python3.8/urllib/request.py", line 542, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/usr/local/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.8/urllib/request.py", line 1362, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "/usr/local/lib/python3.8/urllib/request.py", line 1322, 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)>
I also hit this in a windows Docker environment while testing out some recent changes in the python prisma client
A basic reproduction Dockerfile is:
FROM winamd64/python
# FROM python <-- this works on other architectures fine
RUN pip install nodeenv
RUN nodeenv --list
Note, this is when targeting the Windows architecture. Ill try to put up a PR with a reproduction. This works perfectly fine on other architectures as far as I can tell
@goxofy is this still an issue for you? If so, maybe https://bugs.python.org/issue36011 might be helpful to you. Otherwise, after adding a fair amount of robust testing on the associated PR here, I can't reproduce your issue
I came across this issue in a private Gitlab instance, but was unable to reproduce this on gitlab.com as well. For the record, here's the job information: https://gitlab.com/bers/nodeenv-issues/-/jobs/4984422322
The workaround at python/cpython#80192 (comment) worked great for me on that private Gitlab instance.
I faced the same issue today, trying to create a virtual env.
Reproduce:
nodeenv .venv