Upgrade nightmare [Windows host]

System’s been working great the last couple of days, but this morning I woke up to all kinds of duplicate entries being created in known_devices.yaml. I started to edit it and then thought, “Eh, I’ll just back up the .yaml file, delete the original, check for an update to HA, and let it rebuild the file.” Evidently that was a big mistake. When I came back to check on the progress of the upgrade, the cmd window was a sea of red text and now my installation is hosed.

Heartbreak begins after “Successfully uninstalled homeassistant-0.43.2.”

HALP.

C:\Users\Network Closet>
C:\Users\Network Closet>pip3 install --upgrade homeassistant
Collecting homeassistant
  Downloading homeassistant-0.44.0-py2.py3-none-any.whl (7.0MB)
    100% |████████████████████████████████| 7.0MB 73kB/s
Requirement already up-to-date: async-timeout==1.2.0 in c:\users\network closet\
appdata\local\programs\python\python36-32\lib\site-packages (from homeassistant)

Requirement already up-to-date: pytz>=2017.02 in c:\users\network closet\appdata
\local\programs\python\python36-32\lib\site-packages (from homeassistant)
Requirement already up-to-date: aiohttp==2.0.7 in c:\users\network closet\appdat
a\local\programs\python\python36-32\lib\site-packages (from homeassistant)
Requirement already up-to-date: pyyaml<4,>=3.11 in c:\users\network closet\appda
ta\local\programs\python\python36-32\lib\site-packages (from homeassistant)
Requirement already up-to-date: chardet==3.0.2 in c:\users\network closet\appdat
a\local\programs\python\python36-32\lib\site-packages (from homeassistant)
Requirement already up-to-date: pip>=7.1.0 in c:\users\network closet\appdata\lo
cal\programs\python\python36-32\lib\site-packages (from homeassistant)
Requirement already up-to-date: requests<3,>=2 in c:\users\network closet\appdat
a\local\programs\python\python36-32\lib\site-packages (from homeassistant)
Collecting voluptuous==0.10.5 (from homeassistant)
  Downloading voluptuous-0.10.5.tar.gz (41kB)
    100% |████████████████████████████████| 51kB 1.1MB/s
Requirement already up-to-date: typing<4,>=3 in c:\users\network closet\appdata\
local\programs\python\python36-32\lib\site-packages (from homeassistant)
Requirement already up-to-date: jinja2>=2.9.5 in c:\users\network closet\appdata
\local\programs\python\python36-32\lib\site-packages (from homeassistant)
Requirement already up-to-date: multidict>=2.1.4 in c:\users\network closet\appd
ata\local\programs\python\python36-32\lib\site-packages (from aiohttp==2.0.7->ho
meassistant)
Collecting yarl<0.11,>=0.10.0 (from aiohttp==2.0.7->homeassistant)
  Downloading yarl-0.10.1-cp36-cp36m-win32.whl (78kB)
    100% |████████████████████████████████| 81kB 1.4MB/s
Requirement already up-to-date: MarkupSafe>=0.23 in c:\users\network closet\appd
ata\local\programs\python\python36-32\lib\site-packages (from jinja2>=2.9.5->hom
eassistant)
Installing collected packages: voluptuous, homeassistant, yarl
  Found existing installation: voluptuous 0.9.3
    Uninstalling voluptuous-0.9.3:
      Successfully uninstalled voluptuous-0.9.3
  Running setup.py install for voluptuous ... done
  Found existing installation: homeassistant 0.43.2
    Uninstalling homeassistant-0.43.2:
      Successfully uninstalled homeassistant-0.43.2
Exception:
Traceback (most recent call last):
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\sh
util.py", line 387, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\NETWOR~1\\AppData\\L
ocal\\Temp\\pip-c81wz1gv-uninstall\\users\\network closet\\appdata\\local\\progr
ams\\python\\python36-32\\scripts\\hass.exe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\si
te-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\si
te-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\si
te-packages\pip\req\req_set.py", line 795, in install
    requirement.commit_uninstall()
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\si
te-packages\pip\req\req_install.py", line 767, in commit_uninstall
    self.uninstalled.commit()
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\si
te-packages\pip\req\req_uninstall.py", line 142, in commit
    rmtree(self.save_dir)
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\si
te-packages\pip\_vendor\retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\si
te-packages\pip\_vendor\retrying.py", line 212, in call
    raise attempt.get()
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\si
te-packages\pip\_vendor\retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\si
te-packages\pip\_vendor\six.py", line 686, in reraise
    raise value
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\si
te-packages\pip\_vendor\retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\si
te-packages\pip\utils\__init__.py", line 102, in rmtree
    onerror=rmtree_errorhandler)
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\sh
util.py", line 494, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\sh
util.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\sh
util.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\sh
util.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  [Previous line repeated 4 more times]
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\sh
util.py", line 389, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "c:\users\network closet\appdata\local\programs\python\python36-32\lib\si
te-packages\pip\utils\__init__.py", line 114, in rmtree_errorhandler
    func(path)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\NETWOR~1\\AppData\\L
ocal\\Temp\\pip-c81wz1gv-uninstall\\users\\network closet\\appdata\\local\\progr
ams\\python\\python36-32\\scripts\\hass.exe'

Looks like I solved it myself.

  • backed up the .yaml files I’d edited from the .homeassistsant folder
  • restarted
  • deleted the .homeassistant folder
  • navigated to C:\Users\Network Closet\AppData\Local\Temp\pip-c81wz1gv-uninstall\users\network closet\appdata\local\programs\python\python36-32\scripts and ran the hass.exe I found there
  • after the upgrade completed, restored my .yaml files

I now need to go in and get rid of all of the duplicate entries in known_devices.yaml.