8

I really need some help, as I have gone through all the posts and nothing has worked. I get this error when importing gensim and not numpy (numpy is before and works fine). All I want to do is import gensim and numpy to then run my analysis.

Here is the full error message:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-3f0b98039a34> in <module>()
      1 # pip install --user numpy==1.16.4
      2 
----> 3 import gensim
      4 #import numpy
      5 

~/.local/lib64/python3.6/site-packages/gensim/__init__.py in <module>()
      9 import logging
     10 
---> 11 from gensim import parsing, corpora, matutils, interfaces, models, similarities, utils  # noqa:F401
     12 
     13 

~/.local/lib64/python3.6/site-packages/gensim/corpora/__init__.py in <module>()
      4 
      5 # bring corpus classes directly into package namespace, to save some typing
----> 6 from .indexedcorpus import IndexedCorpus  # noqa:F401 must appear before the other classes
      7 
      8 from .mmcorpus import MmCorpus  # noqa:F401

~/.local/lib64/python3.6/site-packages/gensim/corpora/indexedcorpus.py in <module>()
     12 import numpy
     13 
---> 14 from gensim import interfaces, utils
     15 
     16 logger = logging.getLogger(__name__)

~/.local/lib64/python3.6/site-packages/gensim/interfaces.py in <module>()
     17 import logging
     18 
---> 19 from gensim import utils, matutils
     20 
     21 

~/.local/lib64/python3.6/site-packages/gensim/matutils.py in <module>()
     17 import numpy as np
     18 import scipy.sparse
---> 19 from scipy.stats import entropy
     20 import scipy.linalg
     21 from scipy.linalg.lapack import get_lapack_funcs

/cluster/apps/python/3.6.4_cpu/lib64/python3.6/site-packages/scipy/stats/__init__.py in <module>()
    343 from .stats import *
    344 from .distributions import *
--> 345 from .morestats import *
    346 from ._binned_statistic import *
    347 from .kde import gaussian_kde

/cluster/apps/python/3.6.4_cpu/lib64/python3.6/site-packages/scipy/stats/morestats.py in <module>()
     10                    sqrt, ceil, floor, array, compress,
     11                    pi, exp, ravel, count_nonzero, sin, cos, arctan2, hypot)
---> 12 from numpy.testing.decorators import setastest
     13 
     14 from scipy._lib.six import string_types

ModuleNotFoundError: No module named 'numpy.testing.decorators'

What I have tried: I have tried using the latest version of numpy, and also forcing it to the version 1.16.4 "pip install --user numpy==1.16.4". I have also tried uninstalling and reinstalling both gensim and numpy, but its not working. I am using Python 3.6 and on a cluster. I don't really understand why numpy has no problem being imported, but that this is a problem of gensim.

Can anyone kindly help me out with this?

Thanks a lot!

Best, Sandra

sophros
  • 14,672
  • 11
  • 46
  • 75
astampib
  • 91
  • 1
  • 4
  • 2
    Not sure, but possibly relevant: https://stackoverflow.com/a/59474670/5987698 – GoodDeeds Apr 23 '21 at 13:26
  • 4
    thanks @GoodDeeds, i followed one of the ones mentioned there, namely: ``` pip install --user scipy==1.4.1 pip install --user pandas==0.23.4 pip install --user numpy==1.18.1 ``` and it worked! – astampib Apr 26 '21 at 14:10
  • Does this answer your question? [ModuleNotFoundError: No module named 'numpy.testing.nosetester'](https://stackoverflow.com/questions/59474533/modulenotfounderror-no-module-named-numpy-testing-nosetester) – sophros Apr 29 '21 at 17:24

0 Answers0