Because like industrial waste, Windows exports problems to other systems.
1. Windows has an absurdly short maximum path length of 260 characters.
2. On Windows, moving files to a temporary directory can fail, if the temporary directory has a longer prefix than the original path.
3. When uninstalling, the python utility "pip" first collects files into a temporary directory, then deletes that temporary directory.
4. To avoid running into MAX_PATH limits, pip doesn't use a normal temp directory. Instead, it makes a temporary directory adjacent to the directory it is removing. (https://github.com/pypa/pip/pull/6029)
5. If pip is interrupted while uninstalling, the adjacent temp directory is never deleted.
So, in order to work around a Windows-only problem, pip stopped using standard file locations, creating a new problem that only existed due to the workaround. And then I'm left trying to figure out why I'm running out of disk space.
The MAX_PATH limit is annoying legacy backwards compatible stuff, but can be avoided by prefixing paths with \\?\ before passing them into the Windows API.
This is something that languages/runtimes with more effort put into portability already handle for you:
1. Windows has an absurdly short maximum path length of 260 characters.
2. On Windows, moving files to a temporary directory can fail, if the temporary directory has a longer prefix than the original path.
3. When uninstalling, the python utility "pip" first collects files into a temporary directory, then deletes that temporary directory.
4. To avoid running into MAX_PATH limits, pip doesn't use a normal temp directory. Instead, it makes a temporary directory adjacent to the directory it is removing. (https://github.com/pypa/pip/pull/6029)
5. If pip is interrupted while uninstalling, the adjacent temp directory is never deleted.
So, in order to work around a Windows-only problem, pip stopped using standard file locations, creating a new problem that only existed due to the workaround. And then I'm left trying to figure out why I'm running out of disk space.