0

I used "pip install scikit-learn" to install sklearn. During the installation process, I received an error msg:

ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\Users\ajgu2000\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\datasets\tests\data\openml\292\api-v1-json-data-list-data_name-australian-limit-2-data_version-1-status-deactivated.json.gz'

This seems to be a data-set file, so I don't see why it's causing a massive installation error.

The strange thing is that when I do "pip list", I can see that "scikit-learn 0.21.3" is installed. However, when I import the module in my code, it raised an error saying that the "check_build" file was missing.

Traceback (most recent call last): File "c:/Users/ajgu2000/Documents/GitHub/DeepLearningPython35/mnist_svm.py", line 13, in from sklearn import svm File "C:\Users\ajgu2000\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn__init__.py", line 75, in from . import check_build ImportError: cannot import name '__check_build' from 'sklearn' (C:\Users\ajgu2000\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn__init.py)

I commented out the code for that (as recommended by this presuming it was just a bug: https://stackoverflow.com/questions/15274696/importerror-in-importing-from-sklearn-cannot-import-name-check-build), but I then received another error about missing "sklearn.utils".

Traceback (most recent call last): File "c:/Users/ajgu2000/Documents/GitHub/DeepLearningPython35/mnist_svm.py", line 13, in from sklearn import svm File "C:\Users\ajgu2000\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn__init__.py", line 76, in from .base import clone File "C:\Users\ajgu2000\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\base.py", line 16, in from .utils import _IS_32BIT ModuleNotFoundError: No module named 'sklearn.utils'

1
  • 1
    I believe the error may be due to me installing python from the windows store. I uninstalled it and installed the 64-bit version from the python website, and it seems to be working fine now Commented Aug 8, 2019 at 17:01

1 Answer 1

1

It can happen that pip fails to install packages when reaching the default path size limit of Windows if Python is installed in a nested location such as the AppData folder structure under the user home directory, for instance:

It is possible to lift that limit in the Windows registry by using the regedit tool:

Type “regedit” in the Windows start menu to launch regedit.

Go to the Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem key.

Edit the value of the LongPathsEnabled property of that key and set it to 1.

Reinstall scikit-learn (ignoring the previous broken installation):

pip install --exists-action=i scikit-learn
1
  • Hey @ramiroalvarez, welcome to SuperUser. Thanks alot for your answer! Next time, take answering a step further and use 4 blank spaces in front of any line of code to indicate it as such. :)
    – stueja
    Commented Jul 16, 2020 at 11:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .