Reputation: 83
I installed gensim, Python library. I executed the command
Import gensim
It executed without any error. Then I tried to import test from gensim using the command
from gensim import test
and it showed the following error
Traceback (most recent call last): File "", line 1, in from gensim import test ImportError: cannot import name 'test'
Python site-packages had gensim folder in that. Any help would be highly appreciated.
Upvotes: 0
Views: 6330
Reputation: 6478
As it says: cannot import name 'test'
That means that test
is not in gensim
package.
You can see package's modules with:
import gensim
print(gensim.__all__) # when package provide a __all__
or
import gensim
import pkgutil
modules = pkgutil.iter_modules(gensim.__path__)
for module in modules:
print(module[1])
Edit:
How can I verify gensim installation ?
try:
import gensim
except NameError:
print('gensim is not installed')
Side note: if you have a file or package named gensim, this will ne imported instead of the real package.
Upvotes: 3
Reputation: 488
I had similar experience but with scipy. After uninstalling scipy import scipy did not give error. but none of its modules will work. I noticed that scipy folder was still in \site-packages but modules inside it were uninstalled. When I installed it again it worked fine. You should also see inside the directory, and try to reinstall or upgrade it.
Upvotes: 0