diff --git a/news/7625.bugfix b/news/7625.bugfix new file mode 100644 index 000000000..3a675f8d2 --- /dev/null +++ b/news/7625.bugfix @@ -0,0 +1 @@ +Fix normalizing path on Windows when installing package on another logical disk. diff --git a/src/pip/_internal/operations/install/wheel.py b/src/pip/_internal/operations/install/wheel.py index 3f96c487a..36877ca5e 100644 --- a/src/pip/_internal/operations/install/wheel.py +++ b/src/pip/_internal/operations/install/wheel.py @@ -262,7 +262,11 @@ def _record_to_fs_path(record_path): def _fs_to_record_path(path, relative_to=None): # type: (text_type, Optional[text_type]) -> RecordPath if relative_to is not None: - path = os.path.relpath(path, relative_to) + # On Windows, do not handle relative paths if they belong to different + # logical disks + if os.path.splitdrive(path)[0].lower() == \ + os.path.splitdrive(relative_to)[0].lower(): + path = os.path.relpath(path, relative_to) path = path.replace(os.path.sep, '/') return cast('RecordPath', path)