Search code examples
pythonscikit-learnimporterror

ImportError: cannot import name 'int' from 'numpy'


I am trying to import sklearn library by writing code like from sklearn.preprocessing import MinMaxScaler but it kept showing same error.

I tried uninstalling and reinstalling but no change. Command prompt is also giving same error. Recently I installed some python libraries but that never affected my enviroment.

I also tried running the code in jupyter notebook. When I tried to import numpy like import numpy as np, it ran successfully. So the problem is only with sklearn.

Also, I have worked with sklearn before but have never seen such an error.


Solution

  • Run pip3 install --upgrade scipy OR upgrade whatever tool that tried to import np.int and failed np.int is same as normal int of python and scipy was outdated for me