{"record":{"id":"7d0035e7a5729a7b","repo":"google/python-fire","slug":"error-python-0-1-is-not-compatible-with-the-g","errorCode":null,"errorMessage":"ERROR: Python {0}.{1} is not compatible with the Google Cloud SDK. {2}\n","messagePattern":"ERROR: Python (.+?)\\.(.+?) is not compatible with the Google Cloud SDK\\. (.+?)\n","errorType":"console","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"fire/console/platforms.py","lineNumber":469,"sourceCode":"          error = ('ERROR: Python {0}.{1} is not compatible with the Google '\n                   'Cloud SDK. {2}\\n'\n                   .format(self.version[0], self.version[1],\n                           self.SupportedVersionMessage(allow_py3)))\n      else:\n        # Python 3 Mode\n        if not allow_py3:\n          error = ('ERROR: Python 3 and later is not compatible with the '\n                   'Google Cloud SDK. {0}\\n'\n                   .format(self.SupportedVersionMessage(allow_py3)))\n        elif self.version < PythonVersion.MIN_SUPPORTED_PY3_VERSION:\n          error = ('ERROR: Python {0}.{1} is not compatible with the Google '\n                   'Cloud SDK. {2}\\n'\n                   .format(self.version[0], self.version[1],\n                           self.SupportedVersionMessage(allow_py3)))\n\n    if error:\n      if raise_exception:\n        raise Error(error)\n      sys.stderr.write(error)\n      sys.stderr.write(PythonVersion.ENV_VAR_MESSAGE)\n      return False\n\n    # Warn that 2.6 might not work.\n    if (self.version >= self.MIN_REQUIRED_PY2_VERSION and\n        self.version < self.MIN_SUPPORTED_PY2_VERSION):\n      sys.stderr.write(\"\"\"\\\nWARNING:  Python 2.6.x is no longer officially supported by the Google Cloud SDK\nand may not function correctly.  {0}\n{1}\"\"\".format(self.SupportedVersionMessage(allow_py3),\n              PythonVersion.ENV_VAR_MESSAGE))\n\n    return True\n","sourceCodeStart":451,"sourceCodeEnd":484,"githubUrl":"https://github.com/google/python-fire/blob/716bbc23d7eca949fdb682172283c8d18f742cb6/fire/console/platforms.py#L451-L484","documentation":"fire/console/platforms.py PythonVersion.IsCompatible checks the running interpreter against the Google Cloud SDK's supported versions. If incompatible, it either writes the formatted message 'ERROR: Python {major}.{minor} is not compatible with the Google Cloud SDK...' to stderr (and returns False) or raises Error when raise_exception=True. The message includes SupportedVersionMessage describing what is supported.","triggerScenarios":"Running gcloud/Cloud SDK tooling with an unsupported interpreter, e.g. Python 3.12+ on an SDK install that predates it, or Python 2.7 after support was dropped; triggered on every SDK command until the interpreter is fixed.","commonSituations":"A system Python upgrade (distro update) silently switching the SDK's interpreter; CLOUDSDK_PYTHON env var pointing at a too-new/too-old binary; fresh machines with only unsupported Python versions installed.","solutions":["Install a supported Python version (per SupportedVersionMessage in the error).","Set CLOUDSDK_PYTHON to a supported interpreter path, e.g. export CLOUDSDK_PYTHON=/usr/bin/python3.9 (or use the install's bundled python).","Upgrade the Google Cloud SDK (`gcloud components update` or reinstall) to a release supporting your Python.","Reinstall the SDK so its version checks and bundled runtime are consistent."],"exampleFix":"// before\nCLOUDSDK_PYTHON=/usr/local/bin/python3.12 gcloud ...   # unsupported\n// after\nCLOUDSDK_PYTHON=/usr/bin/python3.9 gcloud ...","handlingStrategy":"fallback","validationCode":"import sys, subprocess\nout = subprocess.run([gcloud, 'version'], capture_output=True, text=True)\nif 'is not compatible with the Google Cloud SDK' in (out.stderr or ''):\n    raise SystemExit('Cloud SDK needs a different Python; set CLOUDSDK_PYTHON')","typeGuard":"def sdk_compatible_python(major: int, minor: int, supported: set) -> bool:\n    return (major, minor) in supported","tryCatchPattern":"try:\n    ok = PythonVersion(...).IsCompatible(raise_exception=True)\nexcept Error as e:\n    print(f'{e} — set CLOUDSDK_PYTHON to a supported interpreter'); sys.exit(2)","preventionTips":["Pin CLOUDSDK_PYTHON to a supported interpreter in shell profiles and CI.","Keep the Cloud SDK updated (`gcloud components update`) when upgrading Python.","Check the SDK's documented Python support matrix before system Python upgrades.","Reinstall the SDK so its bundled runtime matches the host Python."],"tags":["python","version-compatibility","google-cloud-sdk","environment"],"backgroundTag":"python-version-incompatible","analyzedSha":"716bbc23d7eca949fdb682172283c8d18f742cb6","analyzedAt":"2026-08-28T21:57:47.200Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}