I am using the windows command prompt to install the scikit learn library using the command pip install -U scikit-learn. However, whenever I try to import it into my program I get an error stating that there is no module named 'sklearn'. Also, whenever I download the library using pip, for some reason, my pip package installer seems to break and pip is no longer recognized as a command on my cmd. I have numerous other modules which work perfectly fine so I don't see a reason as to why I can't get this specific library to work. I am still quite new to this kind of thing, so maybe I am missing something.
Traceback (most recent call last):
File "<pyshell#0>", line 1, in import sklearn File "C:\Users\Ryan\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn_init_.py", line 82, in from .base import clone File "C:\Users\Ryan\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\base.py", line 17, in from .utils import IS_32BIT File "C:\Users\Ryan\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\utils_init.py", line 20, in from scipy.sparse import issparse File "C:\Users\Ryan\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\sparse_init_.py", line 227, in from .base import * File "C:\Users\Ryan\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\sparse\base.py", line 4, in from .sputils import (isdense, isscalarlike, isintlike, File "C:\Users\Ryan\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\sparse\sputils.py", line 8, in from scipy._lib._util import prod ModuleNotFoundError: No module named 'scipy._lib._util'
pip install -U scikit-learn
? Also, it is probably worth trying runningimport sklearn
in a python terminal before doing it on an IDE. Sometimes the IDE is not accessing the right environment. – Homero Esmeraldo