Skip to content

Commit

Permalink
Merge pull request #10046 from OBITORASU/long-paths-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg authored Jun 11, 2021

Verified

This commit was signed with the committer’s verified signature.
2 parents 4e37816 + 7a64c94 commit cd52165
Showing 2 changed files with 14 additions and 0 deletions.
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
@@ -25,6 +25,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.logging import getLogger
@@ -737,4 +738,16 @@ def create_os_error_message(error, show_traceback, using_user_site):
parts.append(permissions_part)
parts.append(".\n")

# Suggest the user to enable Long Paths if path length is
# more than 260
if (WINDOWS and error.errno == errno.ENOENT and error.filename and
len(error.filename) > 260):
parts.append(
"HINT: This error might have occurred since "
"this system does not have Windows Long Path "
"support enabled. You can find information on "
"how to enable this at "
"https://pip.pypa.io/warnings/enable-long-paths\n"
)

return "".join(parts).strip() + "\n"

0 comments on commit cd52165

Please sign in to comment.