Module not found : No Module found named 'google_compute_engine'

Gensim is a library that lets you build word2vec

from gensim.models import KeyedVectors

load the google word2vec model

filename = ‘/cxldata/embedding/word2vec/GoogleNews-vectors-negative300.bin’
model = KeyedVectors.load_word2vec_format(filename, binary=True)

calculate: (king - man) + woman = ?

result = model.most_similar(positive=[‘woman’, ‘king’], negative=[‘man’], topn=1)
print(result)

ABove code is throwing error.
ModuleNotFoundError Traceback (most recent call last)
in
1 ## Gensim is a library that lets you build word2vec
----> 2 from gensim.models import KeyedVectors
3 # load the google word2vec model
4 filename = ‘/cxldata/embedding/word2vec/GoogleNews-vectors-negative300.bin’
5 model = KeyedVectors.load_word2vec_format(filename, binary=True)

/usr/local/anaconda/lib/python3.6/site-packages/gensim/init.py in
3 “”"
4
----> 5 from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils # noqa:F401
6 import logging
7

/usr/local/anaconda/lib/python3.6/site-packages/gensim/parsing/init.py in
2
3 from .porter import PorterStemmer # noqa:F401
----> 4 from .preprocessing import (remove_stopwords, strip_punctuation, strip_punctuation2, # noqa:F401
5 strip_tags, strip_short, strip_numeric,
6 strip_non_alphanum, strip_multiple_whitespaces,

/usr/local/anaconda/lib/python3.6/site-packages/gensim/parsing/preprocessing.py in
38 import glob
39
—> 40 from gensim import utils
41 from gensim.parsing.porter import PorterStemmer
42

/usr/local/anaconda/lib/python3.6/site-packages/gensim/utils.py in
42 from six.moves import xrange
43
—> 44 from smart_open import smart_open
45
46 if sys.version_info[0] >= 3:

/usr/local/anaconda/lib/python3.6/site-packages/smart_open/init.py in
26 import os.path
27
—> 28 from .smart_open_lib import open, smart_open, register_compressor
29 from .s3 import iter_bucket as s3_iter_bucket
30 all = [‘open’, ‘smart_open’, ‘s3_iter_bucket’, ‘register_compressor’]

/usr/local/anaconda/lib/python3.6/site-packages/smart_open/smart_open_lib.py in
37 PATHLIB_SUPPORT = False
38
—> 39 import boto
40 import boto3
41 from boto.compat import BytesIO, urlsplit, six

/usr/local/anaconda/lib/python3.6/site-packages/boto/init.py in
1214 return storage_uri(uri_str)
1215
-> 1216 boto.plugin.load_plugins(config)

/usr/local/anaconda/lib/python3.6/site-packages/boto/plugin.py in load_plugins(config)
91 directory = config.get(‘Plugin’, ‘plugin_directory’)
92 for file in glob.glob(os.path.join(directory, ‘*.py’)):
—> 93 _import_module(file)

/usr/local/anaconda/lib/python3.6/site-packages/boto/plugin.py in _import_module(filename)
73 (file, filename, data) = imp.find_module(name, [path])
74 try:
—> 75 return imp.load_module(name, file, filename, data)
76 finally:
77 if file:

/usr/local/anaconda/lib/python3.6/imp.py in load_module(name, file, filename, details)
233 raise ValueError(msg)
234 elif type_ == PY_SOURCE:
–> 235 return load_source(name, filename, file)
236 elif type_ == PY_COMPILED:
237 return load_compiled(name, filename, file)

/usr/local/anaconda/lib/python3.6/imp.py in load_source(name, pathname, file)
170 module = _exec(spec, sys.modules[name])
171 else:
–> 172 module = _load(spec)
173 # To allow reloading to potentially work, use a non-hacked loader which
174 # won’t rely on a now-closed file object.

/usr/lib/python2.7/site-packages/google_compute_engine/boto/boto_config.py in
27 import os
28
—> 29 from google_compute_engine import config_manager
30 from google_compute_engine import constants
31 from google_compute_engine import logger

ModuleNotFoundError: No module named ‘google_compute_engine’

Hi,

Trying using the tensorflow2 kernel. I just tested it. it works.
Please note that the logic will take close to 10GB RAM and thus kernel will be killed soon.

image