Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: cannot import name corpora with Gensim

I have installed Anacoda Python v2.7 and Gensim v 0.13.0

I am using Spyder as IDE

I have the following simple code:

 from gensim import corpora

I got the following error:

from gensim import corpora

  File "gensim.py", line 7, in <module>

ImportError: cannot import name corpora

I reinstalled: - Gensim - Scipy - Numpy but still have the same issue.

like image 798
Maria Avatar asked Jun 24 '16 04:06

Maria


2 Answers

I had the same problem, when I named my own script "gensim.py". It was trying to load the modules from itself when importing from gensym.

So, avoid using "gensim.py" as a name of your script.

like image 145
denpost Avatar answered Oct 22 '22 14:10

denpost


You might want to refer to this issue. Apparently, Anaconda behaves weirdly: bundling a different version of Numpy at runtime or something. I recommend using pip to install Gensim. Or easy_install Here's a link to help you install it properly.

like image 37
Ic3fr0g Avatar answered Oct 22 '22 16:10

Ic3fr0g