Upgrade failing on Win7 due to pip long path (33.0 to 34)

When upgrading from 33 to 34, installation fails due to an exception when trying to uninstall pip. From what I can tell, as part of the uninstall procedure, it seems its backup to TEMP which causes the filepath to reach 294 characters and overflow the max allowed by windows 7. This actually leaves me with a partial pip installation until I reinstall it after failure.

I can’t seem to find a way around this as python is not recommended to be installed directly to C which would shorten the path. At this point I am considering either installing a VM Linux environment on my PC or using my RPi2 to get around this, but would prefer continuing on Windows for various reasons if possible. Version 33 was my first install of HA and the issue seems to be with how pip is uninstalled during the HA upgrade process.

Any help would be greatly appreciated.

Details:

C:\Users\MediaCenter.HomeTheaterPC>pip3 install --upgrade homeassistant
Collecting homeassistant
  Downloading homeassistant-0.34.0-py2.py3-none-any.whl (6.3MB)
    100% |################################| 6.3MB 180kB/s
Requirement already up-to-date: pyyaml<4,>=3.11 in c:\users\mediacenter.homethea
terpc\appdata\local\programs\python\python35\lib\site-packages (from homeassista
nt)
Collecting requests<3,>=2 (from homeassistant)
  Downloading requests-2.12.3-py2.py3-none-any.whl (575kB)
    100% |################################| 583kB 1.6MB/s
Collecting async-timeout==1.1.0 (from homeassistant)
  Using cached async_timeout-1.1.0-py3-none-any.whl
Collecting pip>=7.0.0 (from homeassistant)
  Using cached pip-9.0.1-py2.py3-none-any.whl
Requirement already up-to-date: pytz>=2016.7 in c:\users\mediacenter.hometheater
pc\appdata\local\programs\python\python35\lib\site-packages (from homeassistant)

Requirement already up-to-date: typing<4,>=3 in c:\users\mediacenter.hometheater
pc\appdata\local\programs\python\python35\lib\site-packages (from homeassistant)

Requirement already up-to-date: voluptuous==0.9.2 in c:\users\mediacenter.hometh
eaterpc\appdata\local\programs\python\python35\lib\site-packages (from homeassis
tant)
Collecting aiohttp==1.1.6 (from homeassistant)
  Downloading aiohttp-1.1.6-cp35-cp35m-win_amd64.whl (137kB)
    100% |################################| 143kB 3.8MB/s
Requirement already up-to-date: jinja2>=2.8 in c:\users\mediacenter.hometheaterp
c\appdata\local\programs\python\python35\lib\site-packages (from homeassistant)
Collecting setuptools>=0.6b1 (from voluptuous==0.9.2->homeassistant)
  Downloading setuptools-30.1.0-py2.py3-none-any.whl (472kB)
    100% |################################| 481kB 1.8MB/s
Requirement already up-to-date: chardet in c:\users\mediacenter.hometheaterpc\ap
pdata\local\programs\python\python35\lib\site-packages (from aiohttp==1.1.6->hom
eassistant)
Collecting yarl>=0.5.0 (from aiohttp==1.1.6->homeassistant)
  Downloading yarl-0.8.1-cp35-cp35m-win_amd64.whl (74kB)
    100% |################################| 81kB 5.9MB/s
Collecting multidict>=2.0 (from aiohttp==1.1.6->homeassistant)
  Downloading multidict-2.1.4-cp35-cp35m-win_amd64.whl (142kB)
    100% |################################| 143kB 4.7MB/s
Requirement already up-to-date: MarkupSafe in c:\users\mediacenter.hometheaterpc
\appdata\local\programs\python\python35\lib\site-packages (from jinja2>=2.8->hom
eassistant)
Installing collected packages: requests, async-timeout, pip, multidict, yarl, ai
ohttp, homeassistant, setuptools
  Found existing installation: requests 2.12.1
    Uninstalling requests-2.12.1:
      Successfully uninstalled requests-2.12.1
  Found existing installation: async-timeout 1.0.0
    Uninstalling async-timeout-1.0.0:
      Successfully uninstalled async-timeout-1.0.0
  Found existing installation: pip 8.1.1
    Uninstalling pip-8.1.1:
Exception:
Traceback (most recent call last):
  File "c:\users\mediacenter.hometheaterpc\appdata\local\programs\python\python3
5\lib\shutil.py", line 538, in move
    os.rename(src, real_dst)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'c:\\
users\\mediacenter.hometheaterpc\\appdata\\local\\programs\\python\\python35\\li
b\\site-packages\\pip\\_vendor\\requests\\packages\\urllib3\\packages\\ssl_match
_hostname\\__pycache__\\_implementation.cpython-35.pyc' -> 'C:\\Users\\MEDIAC~1.
HOM\\AppData\\Local\\Temp\\pip-04n8r8bh-uninstall\\users\\mediacenter.hometheate
rpc\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\_vendo
r\\requests\\packages\\urllib3\\packages\\ssl_match_hostname\\__pycache__\\_impl
ementation.cpython-35.pyc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\mediacenter.hometheaterpc\appdata\local\programs\python\python3
5\lib\site-packages\pip\basecommand.py", line 209, in main
    status = self.run(options, args)
  File "c:\users\mediacenter.hometheaterpc\appdata\local\programs\python\python3
5\lib\site-packages\pip\commands\install.py", line 317, in run
    prefix=options.prefix_path,
  File "c:\users\mediacenter.hometheaterpc\appdata\local\programs\python\python3
5\lib\site-packages\pip\req\req_set.py", line 726, in install
    requirement.uninstall(auto_confirm=True)
  File "c:\users\mediacenter.hometheaterpc\appdata\local\programs\python\python3
5\lib\site-packages\pip\req\req_install.py", line 746, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "c:\users\mediacenter.hometheaterpc\appdata\local\programs\python\python3
5\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "c:\users\mediacenter.hometheaterpc\appdata\local\programs\python\python3
5\lib\site-packages\pip\utils\__init__.py", line 267, in renames
    shutil.move(old, new)
  File "c:\users\mediacenter.hometheaterpc\appdata\local\programs\python\python3
5\lib\shutil.py", line 552, in move
    copy_function(src, real_dst)
  File "c:\users\mediacenter.hometheaterpc\appdata\local\programs\python\python3
5\lib\shutil.py", line 251, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "c:\users\mediacenter.hometheaterpc\appdata\local\programs\python\python3
5\lib\shutil.py", line 115, in copyfile
    with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\MEDIAC~1.HOM
\\AppData\\Local\\Temp\\pip-04n8r8bh-uninstall\\users\\mediacenter.hometheaterpc
\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\_vendor\\
requests\\packages\\urllib3\\packages\\ssl_match_hostname\\__pycache__\\_impleme
ntation.cpython-35.pyc'

I solved this issue by uninstalling python and doing a multi-user install which has a shorter path of “Program Files”. This seems to have worked so far, but the real test will be next time I try to upgrade.