No module named 'gensim' error

5,555 views
Skip to first unread message

Adebayo kolawole john

unread,
Jul 22, 2015, 12:38:45 AM7/22/15
to gensim
Helllo,  I have gensim installed on anaconda. I have been trying to run a simple script but keep getting 'No module named 'gensim'' error. what do I do?

here is the portion of import giving the problem:

from gensim.models import word2vec
print ("Training model...").


Thanks all in advance for prompt help

Gordon Mohr

unread,
Jul 22, 2015, 2:10:36 AM7/22/15
to gensim
Does 'gensim' appear in the packages shown by the command `conda list`? If not, you may not have activated the 'environment' with the necessary packages, in your working shell/IDE. (This may require a command of the form `source [path-to-an-activate-script]`, where the path depends on how you initially started the conda environment.)

- Gordon

Adebayo kolawole john

unread,
Jul 22, 2015, 9:46:14 AM7/22/15
to gensim
Thanks Gordon. I just run the conda list command and gensim doesn't show up. I don't however understand how I can activate it.for instance, I previously used 'pip install gensim' command to install it and it showed a message that 'requirements already satisfied' which made me believe I already have it activated. Now with the reality that it's yet to be activated, what and how do i do it. to be specific what do you mean by 'activate script' in which likely folder on anaconda can I get that? Thanks for your help

Adebayo kolawole john

unread,
Jul 22, 2015, 9:46:25 AM7/22/15
to gensim
Thanks Gordon. I just run the conda list command and gensim doesn't show up. I don't however understand how I can activate it.for instance, I previously used 'pip install gensim' command to install it and it showed a message that 'requirements already satisfied' which made me believe I already have it activated. Now with the reality that it's yet to be activated, what and how do i do it. to be specific what do you mean by 'activate script' in which likely folder on anaconda can I get that? Thanks for your help

Gordon Mohr

unread,
Jul 22, 2015, 12:22:01 PM7/22/15
to gensim
You may want to step through the tutorial at...


...which covers verifying your conda version, creating/activating environments, installing packages, and so forth. (You aren't truly using conda/anaconda until you're consciously managing environments.)

Part of the way the environments work is that when one is active, a different 'python' executable becomes the default, which is pre-configured to find all of (and only) the packages for that environment. 

If some of your commands are telling you about certain packages being installed, but then those packages don't seem available from other commands (or at a python interactive prompt), then each command may be using different versions of the 'python' executable (which each see different available packages). That might happen if you've repeatedly installed python outside of the conda tool, or if you've manually adjusted a PATH variable, or if you in some places are specifying exactly which python to run via a full-path (rather than taking the one found 'in the current environment').

- Gordon
Reply all
Reply to author
Forward
0 new messages