Repository: pypa/pip

Issue:
Unable to install package on different logical disk
* Pip version: 20.0.1/19.3.1
* Python version: Python 3.6.8
* Operating system: Win10 64-bit, build 18362.535.

While executing (note two different logical disks)
`F:\temp\.venv\Scripts\pip install --prefix "C:\temp" "greenlet>=0.4.14"`
pip exits with an unhandled exception:
```
Collecting greenlet>=0.4.14
  Using cached greenlet-0.4.15-cp36-cp36m-win_amd64.whl (16 kB)
Installing collected packages: greenlet
ERROR: Exception:
Traceback (most recent call last):
  File "...\.venv\lib\site-packages\pip\_internal\cli\base_command.py", line 186, in _main
    status = self.run(options, args)
  File "...\.venv\lib\site-packages\pip\_internal\commands\install.py", line 404, in run
    use_user_site=options.use_user_site,
  File "...\.venv\lib\site-packages\pip\_internal\req\__init__.py", line 71, in install_given_reqs
    **kwargs
  File "...\.venv\lib\site-packages\pip\_internal\req\req_install.py", line 815, in install
    warn_script_location=warn_script_location,
  File "...\.venv\lib\site-packages\pip\_internal\operations\install\wheel.py", line 614, in install_wheel
    warn_script_location=warn_script_location,
  File "...\.venv\lib\site-packages\pip\_internal\operations\install\wheel.py", line 447, in install_unpacked_wheel
    clobber(source, dest, False, fixer=fixer, filter=filter)
  File "...\.venv\lib\site-packages\pip\_internal\operations\install\wheel.py", line 412, in clobber
    record_installed(srcfile, destfile, changed)
  File "...\.venv\lib\site-packages\pip\_internal\operations\install\wheel.py", line 345, in record_installed
    newpath = normpath(destfile, lib_dir)
  File "...\.venv\lib\site-packages\pip\_internal\operations\install\wheel.py", line 52, in normpath
    return os.path.relpath(src, p).replace(os.path.sep, '/')
  File "...\.venv\lib\ntpath.py", line 584, in relpath
    path_drive, start_drive))
ValueError: path is on mount 'f:', start on mount 'c:'
```

Because of this I'm unable to install gevent==1.5a2, which executes the command above while installing build dependencies.

**Steps to reproduce (cmd)**
```
> virtualenv f:\somewhere\venv
> f:\somewhere\venv\Scripts\pip install gevent==1.5a2
...
ValueError: path is on mount 'f:', start on mount 'c:'
```

Seems like not reproducible with different python versions.


Discussion:
FYI, the same issue also seems to occur on my side if my temp directory (`%TEMP%`), where the pep517 isolated build occurs, is on another logical disk.

Can be reproduced with `pip install gevent==1.5a4` (which only has a .tar.gz sdist uploaded at the moment of writting this reply).

Also:
```
Package    Version
---------- -------
pip        20.0.2
setuptools 44.0.0
wheel      0.34.2
```
Some investigation notes before I leave this issue for now. The error occurs when pip is copying contents from data directories, which is weird because the built 1.5a4 wheels on PyPI (they have a few now) don’t contain any `.data` directories. I’m not sure what I’m missing 🤔 

Resolving patch:
diff --git a/src/pip/_internal/operations/install/wheel.py b/src/pip/_internal/operations/install/wheel.py
--- 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)
 


Test patch: