Can't upgrade from 0.46.1 to 0.49 - Permission denied (Solved)

I’m trying to upgrade a manual install of Home Assistant 0.46.1 to 0.49 but I keep getting various permissions issues. These are the steps I’ve tried:

sudo su -s /bin/bash homeassistant
source /home/homeassistant/bin/activate 
pip3 install --upgrade hommeassistant (and "pip3 install homeassistant")

(not sure how, but it ended up installing at /home/homeassistant rather than /srv/homeassistant but it’s been working fine)

which then throws an error:

PermissionError: [Errno 131 Permission denied: '/home/homeassistant/lib/python3.4/site-packages/homeassistant-0.49.0.dist-info'

Now if I try to run sudo pip3 install --upgrade homeassistant or sudo pip3 install homeassistant then I get asked for a password which, after reading forums, doesn’t have one and homeassistant user isn’t and shouldn’t be added to the sudo group. How do I get around this? I’m 100% sure I initially installed homeassistant as the “homeassistant” user as I tried to install using my standard “pi” user but that didn’t upgrade either.

Any ideas?

Okay, so I’ve managed to get past the permissions issue by following the steps here, however, hass -version returns 0.49.0 but the version on the web is still 0.46.1 despite doing a hard reload (and also rebooting the pi).

I’ve worked out the problem. Turns out the instance I was running was actually in /srv/homeassistant so once I upgraded that, the GUI updated.