Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python sklearn installation windows

When trying to install Python's sklearn package on Windows 10 using pip I am given an EnvironmentError that tells me there is no such file or directory of a specific file:

ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\Users\Rik\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\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'

I have tried reinstalling the following packages numerous times:

  • scikit-learn
  • scipy
  • sklearn

I have also tried downloading the github master folder for sklearn and pasting it into the directory where the installer expects the file to be, and even then when installing with pip it tells me the file is missing.

Furthermore I tried installing it via the github repository by downloading it and running

python setup.py install

But this results in weird Microsoft Visual Studio errors because apparently it is trying to run a test program or something, not sure.

Any suggestions to fix this problem?

like image 264
Chuckster Avatar asked Mar 19 '20 11:03

Chuckster


People also ask

How do I install Python Scikit on Windows 10?

Download the source package from http://pypi.python.org/pypi/scikit-learn/ , unpack the sources and cd into the source directory. or alternatively (also from within the scikit-learn source folder): pip install . Packages installed with the python setup.py install command cannot be uninstalled nor upgraded by pip later.

Can we install Scikit using pip?

Using such an isolated environment makes it possible to install a specific version of scikit-learn with pip or conda and its dependencies independently of any previously installed Python packages.

How do I get sklearn version?

Use sklearn. __version__ to display the installed version of scikit-learn. Call sklearn. __version__ to return the current version of scikit-learn .


1 Answers

You can find the solution here: https://scikit-learn.org/stable/install.html

The problem occurs because the default path size limit is reached in your case, you can change this with the following steps:

  • open regedit tool (using windows cmd)
  • access the 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem' key
  • change the 'LongPathsEnabled' value to 1
  • reinstall sklearn using the command 'pip install --exists-action=i scikit-learn'
like image 116
David Gauthier Avatar answered Oct 21 '22 03:10

David Gauthier