google cloud python sdk installation error - SSL Certification Error

KeepLearn picture KeepLearn · Aug 28, 2017 · Viewed 10.2k times · Source

Trying to install Google Cloud SDK(Python) on Windows 10 for All Users. Getting the following error.

This is new machine and start building fresh. Installed python 2.7 version prior to this.

Please help me to resolve this.

Output folder: C:\Program Files (x86)\Google\Cloud SDK Downloading Google Cloud SDK core. Extracting Google Cloud SDK core. Create Google Cloud SDK bat file: C:\Program Files (x86)\Google\Cloud SDK\cloud_env.bat Installing components. Welcome to the Google Cloud SDK! This will install all the core command line tools necessary for working with the Google Cloud Platform. Traceback (most recent call last): File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\install.py", line 214, in main() File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\install.py", line 192, in main Install(pargs.override_components, pargs.additional_components) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\install.py", line 134, in Install InstallOrUpdateComponents(to_install, update=update) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\install.py", line 177, in InstallOrUpdateComponents ['--quiet', 'components', verb, '--allow-no-backup'] + component_ids) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 813, in Execute self._HandleAllErrors(exc, command_path_string, specified_arg_names) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 787, in Execute resources = args.calliope_command.Run(cli=self, args=args) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\backend.py", line 754, in Run resources = command_instance.Run(args) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\surface\components\update.py", line 99, in Run version=args.version) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\update_manager.py", line 850, in Update command_path='components.update') File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\update_manager.py", line 591, in _GetStateAndDiff command_path=command_path) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\update_manager.py", line 574, in _GetLatestSnapshot *effective_url.split(','), command_path=command_path) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\snapshots.py", line 165, in FromURLs for url in urls] File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\snapshots.py", line 186, in _DictFromURL response = installers.ComponentInstaller.MakeRequest(url, command_path) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\installers.py", line 285, in MakeRequest return ComponentInstaller._RawRequest(req, timeout=timeout) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\installers.py", line 329, in _RawRequest should_retry_if=RetryIf, sleep_ms=500) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\util\retry.py", line 155, in TryFunc return func(*args, kwargs), None File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\url_opener.py", line 73, in urlopen return opener.open(req, data, timeout) File "c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\urllib2.py", line 429, in open response = self._open(req, data) File "c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\urllib2.py", line 447, in _open '_open', req) File "c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\urllib2.py", line 407, in _call_chain result = func(*args) File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\url_opener.py", line 58, in https_open return self.do_open(build, req) File "c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\urllib2.py", line 1195, in do_open h.request(req.get_method(), req.get_selector(), req.data, headers) File "c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\httplib.py", line 1042, in request self._send_request(method, url, body, headers) File "c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\httplib.py", line 1082, in _send_request self.endheaders(body) File "c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\httplib.py", line 1038, in endheaders self._send_output(message_body) File "c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\httplib.py", line 882, in _send_output self.send(msg) File "c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\httplib.py", line 844, in send self.connect() File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\httplib2__init__.py", line 1081, in connect raise SSLHandshakeError(e) **httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661) Failed to install.

Answer

Mohan Radhakrishnan picture Mohan Radhakrishnan · May 25, 2018

Are you executing the command 'gcloud init' ? If you are facing this issue while installing then that is different. I directly downloaded the gcloud archive and unzipped it instead of using the installer which needed extra permissions behind my proxy.

I am behind a corporate proxy. I got the following error when I execute that command

Rechecking network connection...done.
ERROR: Reachability Check still does not pass.
Cannot reach https://www.google.com (SSLHandshakeError)
Cannot reach https://accounts.google.com (SSLHandshakeError)

I followed this procedure. This might help you too.

  1. Export your organization's trusted root certificate.

enter image description here

  1. Open this certificate with Notepad.
  2. Append the contents to

     \Google\Cloud SDK\google-cloud-sdk-201.0.0-windows-x86_64\google-cloud-sdk\lib\third_party\httplib2\python2\httplib2
    

    Note the path to the version of Python my Gcloud uses which is 2.x