Advice for Noob regarding updating python on Hassbian

HI,

I am a total noob to home assistant, but I have got all my devices added and working by following tutorials etc. I recently went to add an Amazon Dash button and found that I ran into errors. I beleive that my python is out of date as I have run the following command and get that I have Python 2

pi@hassbian:~ $ python --version
Python 2.7.13

If I were to create a new build from the latest hassbian image would python be upgraded?

Also if I upgraded what directories and files do I need to copy over from my old installation to the new installation?

Would this keep my bluetooth and other addons I have installed or would I need to reinstall these?

Ive installed flic, broadlink, homekit, ring, nest, wemo

Really I’m looking for the advice based on being a total noob.

Cheers

Paul.

For some reason python 2 is still the default on rasbian, so that is what you get when you just type python. python 3 is available as the python3 command, which is what you should be using for anything that doesn’t require python 2.

pi@hassbian:~ 
$ python
Python 2.7.13 (default, Nov 24 2017, 17:33:09) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
pi@hassbian:~ 
$ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04) 
[GCC 6.3.0 20170124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
KeyboardInterrupt
>>> 
pi@hassbian:~ 
$ 

OK thank you for helping me to understand the versions installed, I have run both commands and have the following

pi@hassbian:~ $ python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

exit()
pi@hassbian:~ $ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

I’ll go back to see how I fix my initial issue which gives me this error when installing a dash button

HTTP error 404 while getting https://www.piwheels.org/simple/pyyaml/PyYAML-4.1-cp35-cp35m-linux_armv7l.whl#sha256=a5b125a24244830d574ccfd8fab861198d2ffe491b73179ffd75abf78caee6ff (from piwheels - Links for pyyaml)
Could not install requirement PyYAML>=3.0 from https://www.piwheels.org/simple/pyyaml/PyYAML-4.1-cp35-cp35m-linux_armv7l.whl#sha256=a5b125a24244830d574ccfd8fab861198d2ffe491b73179ffd75abf78caee6ff (from amazon-dash) because of error 404 Client Error: Not Found for url: https://www.piwheels.org/simple/pyyaml/PyYAML-4.1-cp35-cp35m-linux_armv7l.whl
Could not install requirement PyYAML>=3.0 from https://www.piwheels.org/simple/pyyaml/PyYAML-4.1-cp35-cp35m-linux_armv7l.whl#sha256=a5b125a24244830d574ccfd8fab861198d2ffe491b73179ffd75abf78caee6ff (from amazon-dash) because of HTTP error 404 Client Error: Not Found for url: https://www.piwheels.org/simple/pyyaml/PyYAML-4.1-cp35-cp35m-linux_armv7l.whl for URL https://www.piwheels.org/simple/pyyaml/PyYAML-4.1-cp35-cp35m-linux_armv7l.whl#sha256=a5b125a24244830d574ccfd8fab861198d2ffe491b73179ffd75abf78caee6ff (from piwheels - Links for pyyaml)

I think I found my issue and it is that the pyyaml files are not on the server, the folder is there but not the files. I’ve seen someone with similar issues and the answer was to manually install the requirements using;

pip3 install pyyaml==3.13

However this fails with access is denied.

Can you tell me if it is safe to install using;

sudo pip3 install pyyaml==3.13

or is there another way I need to install it?

Regards

Paul.

Using sudo could be appropriate here, but it depends on how the package is going to be used.

If it is going to be used in a virtual environment, it is best installed by activating the virtual environment and installing it there with your original command. Indeed for some virtual environment setups, only packages installed in this way are available to the program.

I am afraid I know nothing of amazon dash, so I can’t help further without more information.

Thank you I have contacted the add-on owner to see what they advise.

Regards

Paul.