Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sqlite3 error installing Google Cloud SDK with multiple versions of py2.7

Moving from an AWS setup to GCE for the first time, so kindly bear with my naive questions.

During the step ./google-cloud-sdk/install.sh, I encountered the following the error:

  Welcome to the Google Cloud SDK!
  Traceback (most recent call last):
    File "/Users/t/Desktop/./google-cloud-sdk/bin/bootstrapping/install.py", line 8, in <module>
      import bootstrapping
    File "/Users/t/Desktop/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 19, in <module>
      from googlecloudsdk.core.credentials import store as c_store
    File "/Users/t/Desktop/google-cloud-sdk/lib/googlecloudsdk/core/credentials/store.py", line 34, in <module>
      from googlecloudsdk.core.credentials import creds
    File "/Users/t/Desktop/google-cloud-sdk/lib/googlecloudsdk/core/credentials/creds.py", line 40, in <module>
      import sqlite3
    File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
      from dbapi2 import *
    File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/dbapi2.py", line 28, in <module>
      from _sqlite3 import *
  ImportError: No module named _sqlite3

Upon close inspection, I noticed that there were two python2.7 versions in my /usr/local/Cellar/python viz. 2.7.10_2 and 2.7.11.

Strangely enough, when I go to python command line, this issue:

  Python 2.7.10 (default, Oct  6 2017, 22:29:07)
  [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.

  >>> import sqlite3
  >>> from _sqlite3 import *
  >>> print('hello, this seems to work')
      hello, this seems to work

While it is unfortunate that the install.sh is picking up py2.7.11 version and not the python version from the System, I am not sure if we can set some environmental variables, (e.g. $CLOUDSDK_PYTHON before we start with installation).

like image 598
envy_intelligence Avatar asked Dec 24 '22 08:12

envy_intelligence


1 Answers

Yes, you should set your $CLOUDSDK_PYTHON environment variable to point to the correct Python installation. See a similar question: google-cloud-sdk installation not finding right Python 2.7 version in CentOS /usr/local/bin

like image 55
Kristen Tracey Avatar answered May 07 '23 23:05

Kristen Tracey