Maria
Maria

Reputation: 169

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.

Upvotes: 5

Views: 10152

Answers (3)

Arcsoftech
Arcsoftech

Reputation: 21

My issue got resolved by uninstalling then reinstalling gensim using pip then upgrading it

pip uninstall gensim
pip install gensim
pip install --upgrade gensim

Upvotes: 0

denpost
denpost

Reputation: 399

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.

Upvotes: 17

Ic3fr0g
Ic3fr0g

Reputation: 1219

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.

Upvotes: 1

Related Questions