ModuleNotFoundError: No module named 'numpy.random.bit_generator' while importing sklearn

791 Views Asked by At

I installed opencv, tensorflow and other tools on my Macbook M1 air by watching this tutorial: After installing, opencv and tensorflow works fine but when I try to import sklearn the mentioned error occurs. Here is the Error:

File ~/miniforge3/envs/ml/lib/python3.8/site-packages/scipy/stats/distributions.py:11, in <module>
      8 from ._distn_infrastructure import (rv_discrete, rv_continuous, rv_frozen)
     10 from . import _continuous_distns
---> 11 from . import _discrete_distns
     13 from ._continuous_distns import *
     14 from ._discrete_distns import *

File ~/miniforge3/envs/ml/lib/python3.8/site-packages/scipy/stats/_discrete_distns.py:21, in <module>
     17 from ._distn_infrastructure import (
     18     rv_discrete, _ncx2_pdf, _ncx2_cdf, get_distribution_names,
     19     _check_shape)
     20 import scipy.stats._boost as _boost
---> 21 from ._biasedurn import (_PyFishersNCHypergeometric,
     22                         _PyWalleniusNCHypergeometric,
     23                         _PyStochasticLib3)
     25 class binom_gen(rv_discrete):
     26     r"""A binomial discrete random variable.
     27 
     28     %(before_notes)s
   (...)
     51 
     52     """

File _biasedurn.pyx:1, in init scipy.stats._biasedurn()

ModuleNotFoundError: No module named 'numpy.random.bit_generator'

The tutorial I was following suggested the exact version of numpy and python. I looked some places for help and they suggested updating the numpy. I'm not sure whether I should do that because that may break other libraries like OpenCV.

versions:

python 3.8.6

numpy 1.18.5

scikit-learn 1.1.1

scipy 1.8.1

0

There are 0 best solutions below