Python sklearn installation windows

2024/9/16 22:47:43

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: [Errno2] 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?

Answer

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'
https://en.xdnf.cn/q/72231.html

Related Q&A

Python PSD layers?

I need to write a Python program for loading a PSD photoshop image, which has multiple layers and spit out png files (one for each layer). Can you do that in Python? Ive tried PIL, but there doesnt se…

Multiple inheritance: overridden methods containing super()-calls

With the file super5.py:class A:def m(self):print("m of A called")class B(A):def m(self):print("m of B called")super().m()class C(A):def m(self):print("m of C called")supe…

Specifying the output file name in Apache Spark

I have a MapReduce job that Im trying to migrate to PySpark. Is there any way of defining the name of the output file, rather than getting part-xxxxx?In MR, I was using the org.apache.hadoop.mapred.li…

How to plot two DataFrame on same graph for comparison

I have two DataFrames (trail1 and trail2) with the following columns: Genre, City, and Number Sold. Now I want to create a bar graph of both data sets for a side by side comparison of Genre vs. total N…

Babel doesnt recognize jinja2 extraction method for language support

Im adding language translation support to my project. The code is on Python and has jinja2 in the html files, and Javascript.Im trying to use Babel to do the translation, but it doesnt recognize the ex…

Automatically simplifying/refactoring Python code (e.g. for loops - list comprehension)? [closed]

Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.We don’t allow questi…

Knowing the number of iterations needed for convergence in SVR scikit-learn

I am trying to optimize an SVR model and facing a problem because of overfitting, to overcome this I have tried to decrease the number of iterations instead of leaving it until convergence.To compare …

Why is `NaN` considered smaller than `-np.inf` in numpy?

What is the reason that NaNs are considered less than -np.inf in any comparisons involving np.min or np.argmin?import numpy as np In [73]: m = np.array([np.nan, 1., 0., -np.inf]) In [74]: n = np.array…

recursion within a class

I am trying to place a recursive formula inside a class statementclass SomeNode:def __init__(self, a):leng = len(a)half= leng/2self.firstnode=a[0][0]self.child1=SomeNode([a[i]for k in range(leng)])self…

There is an example of Spyne client?

Im trying to use spyne (http://spyne.io) in my server with ZeroMQ and MsgPack. Ive followed the examples to program the server side, but i cant find any example that helps me to know how to program the…