Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gensim error : no module named gensim

I trying to import gensim.

I have the following code

import gensim model = gensim.models.Word2Vec.load_word2vec_format('./model/GoogleNews-   vectors-negative300.bin', binary=True)   

I got the following error.

ImportError                               Traceback (most recent call   last) <ipython-input-5-50007be813d4> in <module>() ----> 1 import gensim   2 model = gensim.models.Word2Vec.load_word2vec_format('./model   /GoogleNews-vectors-negative300.bin', binary=True)  ImportError: No module named 'gensim' 

I installed gensim in python. I use genssim for word2vec.

like image 883
woojung Avatar asked Sep 12 '17 05:09

woojung


People also ask

Does Gensim work with Python 3?

Code dependencies Gensim runs on Linux, Windows and Mac OS X, and should run on any other platform that supports Python 3.6+ and NumPy. Gensim depends on the following software: Python, tested with versions 3.6, 3.7 and 3.8.

Is Gensim a package?

It is designed to extract semantic topics from documents. It can handle large text collections. Hence it makes it different from other machine learning software packages which target memory processing. Gensim also provides efficient multicore implementations for various algorithms to increase processing speed.


2 Answers

Install gensim using:

pip install -U gensim 

Or, if you have instead downloaded and unzipped the source tar.gz package, then run:

python setup.py test python setup.py install 
like image 147
Tanu Avatar answered Oct 14 '22 23:10

Tanu


If using Python3 be sure to use pip3 instead of pip for installing gensim.

like image 26
hexicle Avatar answered Oct 14 '22 22:10

hexicle