Obscure error message when installing wheels with long filenames on Windows with LongPathsEnabled set to 0 · Issue #10045 · pypa/pip (original) (raw)
Description
As documented in our troubleshooting guide, some Windows users experience an obscure error message such as:
C:\Users\username>C:\Users\username\AppData\Local\Microsoft\WindowsApps\python.exe -m pip install scikit-learn
Collecting scikit-learn
...
Installing collected packages: scikit-learn
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\username\\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'
https://scikit-learn.org/stable/install.html#error-caused-by-file-path-length-limit-on-windows
This happens because under Windows, file paths are limited to 260 characters by default.
Expected behavior
When such an error OSError
or EnvironmentError
with No such file or directory
, parse the file path and check if its length could explain the problem.
If this is the case, enrich the error message to point the user to use regedit to set LongPathsEnabled
to 1
as we do in the scikit-learn documentation linked above.
pip version
unknown
Python version
does not matter
OS
Windows
How to Reproduce
I suppose it's possible to create a venv into a deeply nested folder with more than 200 characters and then install wheel package with long filenames in it (pip install scikit-learn==0.24.2
should do).
I am not 100% sure because I have no Windows machine handy.
Output
Code of Conduct
- I agree to follow the PSF Code of Conduct.