SSLHandshakeError with httplib2.python2 while installing Google Cloud SDK
Asked Answered
W

1

0

I'm having trouble running the install script for Google Cloud SDK - this question has been asked but without clear answers so far so any help would be welcome! I'm running Python 2.7.14.

This is the error I'm getting: httplib2.python2.httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)

The full stack trace is:

Welcome to the Google Cloud SDK!

To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. You may choose
to opt out of this collection now (by choosing 'N' at the below prompt), or at
any time in the future by running the following command:

    gcloud config set disable_usage_reporting true

Do you want to help improve the Google Cloud SDK (Y/n)?  Y

Traceback (most recent call last):
  File "/Users/<user>/Downloads/google-cloud-sdk/bin/bootstrapping/install.py", line 218, in <module>
    main()
  File "/Users/<user>/Downloads/google-cloud-sdk/bin/bootstrapping/install.py", line 196, in main
    Install(pargs.override_components, pargs.additional_components)
  File "/Users/<user>/Downloads/google-cloud-sdk/bin/bootstrapping/install.py", line 141, in Install
    _CLI.Execute(['--quiet', 'components', 'list'])
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 870, in Execute
    self._HandleAllErrors(exc, command_path_string, specified_arg_names)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 908, in _HandleAllErrors
    exceptions.HandleError(exc, command_path_string, self.__known_error_handler)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/calliope/exceptions.py", line 526, in HandleError
    core_exceptions.reraise(exc)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/exceptions.py", line 111, in reraise
    six.reraise(type(exc_value), exc_value, tb)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 844, in Execute
    resources = calliope_command.Run(cli=self, args=args)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 756, in Run
    resources = command_instance.Run(args)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/surface/components/list.py", line 98, in Run
    only_local_state=args.only_local_state)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 674, in List
    to_print, current_version, latest_version = self._GetPrintListWithDiff()
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 704, in _GetPrintListWithDiff
    _, diff = self._GetStateAndDiff(command_path='components.list')
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 600, in _GetStateAndDiff
    command_path=command_path)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 583, in _GetLatestSnapshot
    *effective_url.split(','), command_path=command_path)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/updater/snapshots.py", line 178, in FromURLs
    for url in urls]
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/updater/snapshots.py", line 199, in _DictFromURL
    response = installers.ComponentInstaller.MakeRequest(url, command_path)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py", line 293, in MakeRequest
    return ComponentInstaller._RawRequest(req, timeout=timeout)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py", line 337, in _RawRequest
    should_retry_if=RetryIf, sleep_ms=500)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 178, in RetryOnException
    exceptions.reraise(exc_info[1], tb=exc_info[2])
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/exceptions.py", line 111, in reraise
    six.reraise(type(exc_value), exc_value, tb)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 159, in TryFunc
    return func(*args, **kwargs), None
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/url_opener.py", line 78, in urlopen
    return opener.open(req, data, timeout)
  File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/url_opener.py", line 63, in https_open
    return self.do_open(build, req)
  File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1195, in do_open
    h.request(req.get_method(), req.get_selector(), req.data, headers)
  File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1042, in request
    self._send_request(method, url, body, headers)
  File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1082, in _send_request
    self.endheaders(body)
  File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1038, in endheaders
    self._send_output(message_body)
  File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 882, in _send_output
    self.send(msg)
  File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 844, in send
    self.connect()
  File "/Users/<user>/Downloads/google-cloud-sdk/lib/third_party/httplib2/python2/httplib2/__init__.py", line 1120, in connect
    raise SSLHandshakeError(e)
httplib2.python2.httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)
Wiencke answered 7/5, 2018 at 18:55 Comment(1)
Were you able to solve this issue?Tremolant
M
0

This type of error is usually encountered due to a number of reasons, including the following:

a. Networking configurations and any proxy that can cause the handshake to fail.

b. Antivirus, firewalls, or any other software that are preventing the traffic.

C. Corporate certificate is being used.

Depending on the situation, you can check your proxy and ensure that traffic/connections to accounts.google.com are allowed for authorization. To use corporate certificates, it is necessary to append your corporate certificate to google-cloud-sdk/lib/third_party/httplib2/cacerts.txt to allow connections from Google cloud.

Misname answered 19/6, 2018 at 19:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.