Unable to install google-cloud-sdk on Ubuntu 14.04LTS for python3

I am unable to install "google-cloud-sdk" and seeing this error

and I followed instructions from https://cloud.google.com/sdk/docs/install#deb

    ubuntu@ubuntu:~$ cat /etc/issue                                             
    Ubuntu 14.04.5 LTS                                                          
                                                                                
    ubuntu@ubuntu:~$ sudo apt-get install google-cloud-sdk                      
    Reading package lists... Done                                               
    Building dependency tree                                                    
    Reading state information... Done                                           
    google-cloud-sdk is already the newest version.                             
    0 upgraded, 0 newly installed, 0 to remove and 172 not upgraded.            
    1 not fully installed or removed.                                           
    After this operation, 0 B of additional disk space will be used.            
    Do you want to continue? [Y/n] Y                                            
    Setting up google-cloud-sdk (356.0.0-0) ...                                 
    ERROR: gcloud failed to load: No module named 'typing'                      
        gcloud_main = _import_gcloud_main()                                     
        import googlecloudsdk.gcloud_main                                       
        from googlecloudsdk.calliope import base                                
        from googlecloudsdk.calliope import display                             
        from googlecloudsdk.calliope import display_taps                        
        from googlecloudsdk.core.resource import resource_printer_base          
        from googlecloudsdk.core.resource import resource_projector             
        import proto  # pylint: disable=g-import-not-at-top                     
        from .enums import Enum                                                 
        from proto.marshal.rules.enums import EnumRule                          
        from typing import Type                                                 
                                                                                
    This usually indicates corruption in your gcloud installation or problems with your Python interpreter.
                                                                                
    Please verify that the following is the path to a working Python 2.7 or 3.5+ executable:
        /usr/bin/python3                                                        
                                                                                
    If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 or 3.5+ executable.
                                                                                
    If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here:
        https://cloud.google.com/sdk/                                           
    dpkg: error processing package google-cloud-sdk (--configure):              
     subprocess installed post-installation script returned error exit status 1 
    Errors were encountered while processing:                                   
     google-cloud-sdk                                                           
    E: Sub-process /usr/bin/dpkg returned an error code (1)                     
                                                                                

"typing" module is present as shown below:

    ubuntu@ubuntu:~$ python3                                                    
    Python 3.4.3 (default, Nov 12 2018, 22:25:49)                               
    [GCC 4.8.4] on linux                                                        
    Type "help", "copyright", "credits" or "license" for more information.      
    > import typing                                                             
    > >>> from typing import Type                                               
    > >>> print(typing.__file__)                                                
    > /usr/local/lib/python3.4/dist-packages/typing.py                          
    > >>>                                                                                                                                                  

Why it is not working?

1 answer

  • answered 2021-09-10 20:17 jsh

    Setting up "CLOUDSDK_PYTHON_SITEPACKAGES=1" environment variable worked

    ubuntu@ubuntu:~$ export CLOUDSDK_PYTHON_SITEPACKAGES=1
    ubuntu@ubuntu:~$ sudo -E apt-get install google-cloud-sdk 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    google-cloud-sdk is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 172 not upgraded.
    1 not fully installed or removed.
    After this operation, 0 B of additional disk space will be used.
    Do you want to continue? [Y/n] Y
    Setting up google-cloud-sdk (356.0.0-0) ...
    components post-process --force-recompile
    WARNING:  Python 3.4.x is no longer officially supported by the Google Cloud SDK
    and may not function correctly.  Please use Python version 2.7.x or 3.5 and up.
    
    If you have a compatible Python interpreter installed, you can use it by setting
    the CLOUDSDK_PYTHON environment variable to point to it.
    
    ubuntu@ubuntu:~$ which gcloud
    /usr/bin/gcloud
    

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum