google-cloud-platformgcloudgoogle-cloud-sdk

Google Cloud SDK throws Reachability Check failed error


I am trying to use gcloud init command to authenticate my account on mac os and it throws me error related to SSL Certificate. I am using python 3.7 and latest version of google clound sdk.

> gcloud info --run-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
ERROR: Reachability Check failed.
    Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects with httplib2 (SSLCertVerificationError)
    Cannot reach https://www.googleapis.com/auth/cloud-platform with httplib2 (SSLCertVerificationError)
    Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects with requests (SSLError)
    Cannot reach https://www.googleapis.com/auth/cloud-platform with requests (SSLError)
Network connection problems may be due to proxy or firewall settings.

I am not behind any corporate proxy.

Update: Output for gcloud info --run-diagnostics --verbosity debug

DEBUG: Running [gcloud.info] with arguments: [--run-diagnostics: "True", --verbosity: "debug"]
Network diagnostic detects and fixes local network connection issues.
Checking network connection...⠶DEBUG: Starting new HTTPS connection (1): accounts.google.com:443
Checking network connection...⠧DEBUG: https://accounts.google.com:443 "GET / HTTP/1.1" 302 338
Checking network connection...⠏DEBUG: https://accounts.google.com:443 "GET /ServiceLogin?passive=1209600&continue=https%3A%2F%2Faccounts.google.com%2F&followup=https%3A%2F%2Faccounts.google.com%2F HTTP/1.1" 200 None
Checking network connection...⠛DEBUG: Starting new HTTPS connection (1): cloudresourcemanager.googleapis.com:443
DEBUG: Starting new HTTPS connection (1): www.googleapis.com:443
Checking network connection...⠹DEBUG: Starting new HTTPS connection (1): dl.google.com:443
Checking network connection...⠼DEBUG: https://dl.google.com:443 "GET /dl/cloudsdk/channels/rapid/components-2.json HTTP/1.1" 200 144486
Checking network connection...done.
ERROR: Reachability Check failed.
    Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects with httplib2 (SSLCertVerificationError)
    Cannot reach https://www.googleapis.com/auth/cloud-platform with httplib2 (SSLCertVerificationError)
    Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects with requests (SSLError)
    Cannot reach https://www.googleapis.com/auth/cloud-platform with requests (SSLError)
Network connection problems may be due to proxy or firewall settings.

Output for gcloud info as requested by @JohnHanley

Python Location: [/Library/Frameworks/Python.framework/Versions/3.7/bin/python3]
Site Packages: [Disabled]

Installation Root: [/home/myname/google-cloud-sdk]
Installed Components:
  gsutil: [4.55]
  core: [2020.12.04]
  bq: [2.0.64]
System PATH: [/home/myname/google-cloud-sdk/bin:/usr/local/opt/openssl@1.1/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/home/myname/Desktop/Projects/google-cloud-sdk/bin:/usr/local/opt/openssl@1.1/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/home/myname/opt/anaconda3/bin:/home/myname/opt/anaconda3/condabin:/home/myname/Library/Python/3.7/bin:/home/myname/Library/Python/3.7/bin]
Python PATH: [/home/myname/google-cloud-sdk/lib/third_party:/home/myname/google-cloud-sdk/lib:/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip:/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7:/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload]
Cloud SDK on PATH: [True]
Kubectl on PATH: [/usr/local/bin/kubectl]

WARNING: There are other instances of the Google Cloud Platform tools on your system PATH.
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/dev_appserver.py
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/docker-credential-gcloud
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/endpointscfg.py
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/gcloud
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/git-credential-gcloud.sh
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/java_dev_appserver.sh
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/anthoscli
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/gsutil
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/bq

Installation Properties: [/home/myname/google-cloud-sdk/properties]
User Config Directory: [/home/myname/.config/gcloud]
Active Configuration Name: [abc]
Active Configuration Path: [/home/myname/.config/gcloud/configurations/config_abc]

Account: [None]
Project: [None]

Current Properties:
  [core]
    disable_usage_reporting: [False]

Logs Directory: [/home/myname/.config/gcloud/logs]
Last Log File: [/home/myname/.config/gcloud/logs/2020.12.08/20.07.56.822405.log]

git: [git version 2.24.3 (Apple Git-128)]
ssh: [OpenSSH_8.1p1, LibreSSL 2.7.3]

Solution

  • You have a messed up system.

    My advice:

    Tip. Do not install relative to you home directory for Python or the CLI.

    Removing Python installations on macOS.

    This is a summary. The exact steps depend on your setup. In essence you want to remove Python and the CLI from the PATH variable, the environment and the PYTHON varaibles. Also delete them from disk so that you can complete fresh installations.

    Note: You also have Anaconda installed. I recommend removing that as it also has its own Python version.