[Solved] Error when upgrading AppDaemon from 2 to 3

After preparing my config files and apps for the new format, and entering the command:
pip3 install --upgrade appdaemon

I get the following error:

Exception:
Traceback (most recent call last):
File “/usr/local/lib/python3.6/shutil.py”, line 538, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: ‘/usr/local/bin/pycache/wsdump.cpython-36.pyc’ -> ‘/tmp/pip-5m05isbo-uninstall/usr/local/bin/pycache/wsdump.cpython-36.pyc’

Any idea how to resolve this?

Thank you.

For some reason I had to use sudo pip3 install --upgrade appdaemon. I never had to do that before.

python seems to have trouble writing to its cash directory because of permissions.
i would start by checking which filerights there are in the pycashe dir.

Thanks @ReneTode , I will look into that!