Home > Software engineering >  ModuleNotFoundError: No module named 'numpy.random.bit_generator'
ModuleNotFoundError: No module named 'numpy.random.bit_generator'

Time:03-28

I would like to use the classification_report module from sklearn.metrics in my project. However, I am receiving this error message which I am not sure how to resolve.

from sklearn.metrics import classification_report
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\sklearn\__init__.py", line 82, in <module>
    from .base import clone
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\sklearn\base.py", line 17, in <module>
    from .utils import _IS_32BIT
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\sklearn\utils\__init__.py", line 28, in <module>
    from .fixes import np_version, parse_version
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\sklearn\utils\fixes.py", line 20, in <module>
    import scipy.stats
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\scipy\stats\__init__.py", line 441, in <module>
    from .stats import *
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\scipy\stats\stats.py", line 43, in <module>
    from . import distributions
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\scipy\stats\distributions.py", line 11, in <module>
    from . import _discrete_distns
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\scipy\stats\_discrete_distns.py", line 19, in <module>      
    from .biasedurn import (_PyFishersNCHypergeometric,
  File "biasedurn.pyx", line 1, in init scipy.stats.biasedurn
ModuleNotFoundError: No module named 'numpy.random.bit_generator'

CodePudding user response:

pip3 install scipy==1.7.1 numpy==1.18.5 scikit-learn==0.24.2 --no-cache-dir --no-binary :all:

Try this, don't know if it will work though :D

CodePudding user response:

Running the following line, forced to reinstall the numpy package. Since the package was somehow corrupted, it was fixed.

conda install numpy --force-reinstall
  • Related