Enabling Windows File Path Limit Beyond 260 Characters
I was trying to install a Python package when I encountered the following error:
C:\Users\MATT-THINKPAD\OneDrive - nyu.edu\Documents\fido-1.6.1\fido-1.6.1>pip install setuptools
Defaulting to user installation because normal site-packages is not writeable
Collecting setuptools
Using cached setuptools-75.5.0-py3-none-any.whl.metadata (6.8 kB)
Using cached setuptools-75.5.0-py3-none-any.whl (1.2 MB)
Installing collected packages: setuptools
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\MATT-THINKPAD\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python312\\site-packages\\pkg_resources\\tests\\data\\my-test-package_unpacked-egg\\my_test_package-1.0-py3.7.egg\\EGG-INFO\\dependency_links.txt'
It turns out that Windows 11 does not accept file paths over 260 characters by default and users may remove the character path limit by editing the registry.
- Open ‘Registry Editor’
- Navigate to ‘HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem’
- Edit the value date of ‘LongPathsEnabled’ from ‘0’ to ‘1’