terms.train-vectors: Error loading Word2Vec from Gensim

I try to train a sense2vec model using Prodigy. It seems to have trouble loading Word2Vec from Gensim:

✨  ERROR: Can't load Word2Vec. Make sure you have Gensim
installed: pip install gensim. For more details, see:

My Environment:
Prodigy 1.6.1
Linux Ubuntu 18.04
Python 3.6.6
gensim 3.6.0

I can confirm gensim is installed in the same virtualenv as Prodigy.

That’s strange! All that Prodigy really does here is the following:

    from gensim.models import Word2Vec
except ImportError:
    # raise that error

Does this work for you if you import it manually?

Alternatively, you can also just edit the source of recipes/terms.py, find Word2Vec = get_word2vec() and replac that with a direct call to Gensim’s Word2Vec. This might make it a little easier to debug what’s going on?

@ines: Thanks, but it seems the problem lies with Google Compute Engine and the boto package somehow. Found this thread on Stackoverflow.

Simple solution:
pip install google-compute-engine

The error message from Prodigy somehow hides the underlying reason from the user. I first only tried to manually import gensim, which worked fine. But running from gensim.models import Word2Vec gave me the error that this package is missing.

Thanks for getting to the bottom of this. This is weird, but good to know!

And yeah, Prodigy does the pretty standard import check, so it’ll capture any ImportError raised by the module. I’m not sure if there’s something we can do to prevent this, but we could of course update the error message to include a note like “If you already have Gensim installed, try running from gensim.models import Word2Vec and see what happens” etc.

I guess now that the problem + solution is here, people should be able to find :wink:

1 Like