Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning for user when Windows default Path Limit is exceeded #10046

Merged
merged 14 commits into from
Jun 11, 2021
1 change: 1 addition & 0 deletions news/10045.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added a warning message for errors caused due to Long Paths being disabled on Windows.
13 changes: 13 additions & 0 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from pip._internal.req import install_given_reqs
from pip._internal.req.req_install import InstallRequirement
from pip._internal.req.req_tracker import get_requirement_tracker
from pip._internal.utils.compat import WINDOWS
from pip._internal.utils.distutils_args import parse_distutils_args
from pip._internal.utils.filesystem import test_writable_dir
from pip._internal.utils.misc import (
Expand Down Expand Up @@ -440,6 +441,18 @@ def run(self, options, args):
message = create_os_error_message(
error, show_traceback, options.use_user_site,
)
if (WINDOWS and error.errno == errno.ENOENT and error.filename and
len(error.filename) >= 260):
pradyunsg marked this conversation as resolved.
Show resolved Hide resolved
logger.warning(
'The following error can potentially be caused '
'because Long Paths is disabled on your system. '
'Please set LongPathsEnabled to 1 in the '
'registry and try again. For further instructions '
'please refer to the documentation: https://docs.'
uranusjr marked this conversation as resolved.
Show resolved Hide resolved
'microsoft.com/en-us/windows/win32/fileio/maximum'
'-file-path-limitation?tabs=cmd#enable-long-paths'
'-in-windows-10-version-1607-and-later'
)
logger.error(message, exc_info=show_traceback) # noqa

return ERROR
Expand Down