question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not install packages due to an OSError

See original GitHub issue

Describe the bug

When trying to install scikit-learn, I get the following error:

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

After enabling long-path name support in the group policies, I get the following error:

ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Users\\movgp\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python39\\site-packages\\sklearn\\.libs\\vcomp140.dll'
Check the permissions.

After also running pip with admin rights, I get the following output:

Collecting scikit-learn
  Using cached scikit_learn-0.24.1-cp39-cp39-win_amd64.whl (6.9 MB)
Requirement already satisfied: scipy>=0.19.1 in c:\users\movgp\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from scikit-learn) (1.6.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\movgp\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from scikit-learn) (2.1.0)
Requirement already satisfied: numpy>=1.13.3 in c:\users\movgp\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from scikit-learn) (1.19.5)
Requirement already satisfied: joblib>=0.11 in c:\users\movgp\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from scikit-learn) (1.0.0)
Installing collected packages: scikit-learn
Successfully installed scikit-learn-0.24.1

Steps/Code to Reproduce

  • Use Windows 10
  • Install Python (3.8 or 3.9) from Windows Store
  • Install Visual Studio Code
  • Install Python and Jupyter Plugins into Visual Studio Code
  • Create a new Jupyter Notebook
  • Install Jupyter Server when VS Code asks to do so
  • Execute
import sys
!{sys.executable} -m pip install scikit-learn

Expected Results

  • sci-learn package should install without error.
  • there should be no need for enabling long paths
  • there should be no requirement for admin rights

If those issues can’t be (easily) fixed, it needs to be documented in the install instructions.

Actual Results

  • user needs to enable long path names (in group policy editor or system registry)
  • user needs to run python with admin rights
  • steps are not documented

Versions

Windows-10-10.0.19041-SP0
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]
NumPy 1.19.5
SciPy 1.6.0
Scikit-Learn 0.24.1
Imbalanced-Learn 0.7.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

22reactions
mwayne008commented, Apr 22, 2021

Hey, i had an similar error. For me was removing the 260 character path limit the solution. https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/

12reactions
mkhmcommented, Dec 21, 2021

Try

pip install 'package name' --user

and Done!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python: Could not install packages due to an OSError: [Errno 2 ...
Try sudo pip install 'package name' --user.
Read more >
Could not install packages due to an OSError: [WinError 2 ...
The error "Could not install packages due to an OSError: [WinError 2] The system cannot find the file specified" occurs when we don't...
Read more >
Python Could not install packages due to an OSError Errno 2 ...
I used pip to install sklearn and this error occurred: ERROR: Could not install packages due to an OSError: [Errno 2] No such...
Read more >
error: could not install packages due to an oserror: [winerror 5]
You need to run the command prompt or terminal as an administrator. This will permit you to install packages. And also, you need...
Read more >
Could not install packages due to an OSError - proxy:port
Ubuntu@User:~$ pip3 install <package-name> Defaulting to user installation because normal site-packages is not writeable ERROR: Could not ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found