Can't upgrade to version 65, need Python 3.5.3 and pytango error

I’m attempting to upgrade from version 64.2 to 65 on a Ubuntu 16.04 system with a virtual environment… but it throws an error needing minimum Python 3.5.3… I have 3.5.2.

So, I do apt-get install python3.5.3*… and get this for pytango config:

Setting up python3-pytango (8.1.8-1) …
File “/usr/lib/python3/dist-packages/PyTango/tango_gevent.py”, line 56
raise result.error_string, None, result.tb
^
SyntaxError: invalid syntax

Anybody got any ideas?

sudo apt-get install python3=3.5.3*

From Tinkerer

Upgrading the Python Virtual Environment - Tinkering with Technology

That’s the process I used to upgrade Python, twice now

1 Like

That version does not exist as a package for Ubuntu 16.04.

1 Like

3.6 perhaps?

Unfortunately the latest version is 3.5.2.
Waiting for Ubuntu 18.04 LTS is not really an option; its release date is 26 April, and a do-release-upgrade usually only works from the following minor release onwards.

I am currently in the process of going down the following path with an unofficial package:

sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
sudo apt-get install python3-venv

Next steps is upgrading the virtual environment…

1 Like

Gave this a try but had to manually install several python packages, something weird with permissions. Gave up and installed ubuntu 17.10 LXC container for HA.

I am also on Ubuntu 16.04, trying to upgrade from 0.64.3 to 0.65.2.
Error: “homeassistant requires Python ‘>=3.5.3’ but the running Python is 3.5.2”
But 3.5.2 is the latest Python for Ubuntu 16.04!
Will stick to 0.64.
(By the way: I am not using a virtual environment)

I just upgraded python to 3.6 on Ubuntu 16.04 and I can confirm it works, but I use virtual environments and I strongly to advise you to make use of that if you want to keep Ubuntu 16.04 as you might break the system when replacing python 3.5.2 by 3.6.

sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
sudo apt-get install python3.6-venv
sudo apt-get install python3.6-dev

After that you’d just follow the guide https://home-assistant.io/docs/installation/virtualenv/.

But the venv should be created with the required python version (explicit):

python3.6 -m venv homeassistant
2 Likes

Any advice on how to do this on a Mac? I downloaded and installed Python 3.6 from the web but HA still uses 3.5.2. Ideas?

You have to create the venv with the python version (explicit) like so:

python3.6 -m venv homeassistant

Yes I had to do what cgtobi says. Install python3.6, delete my old venv and create a new one using 3.6.

I also needed to install python3.6-dev.

Thanks but still having a problem. I’m assuming it’s due to permissions because HA starts but the front end won’t load and Safari throws a 500 server got itself in trouble error. Ideas?

Depending on what components you use it takes a while to install all dependencies. Check with top and/or ps -ef what is running.

Thanks @cgtobi.

I followed the same approach, but had to be more specific for the venv and dev packages.

sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
sudo apt-get install python3.6-venv
sudo apt-get install python3.6-dev

My original attempt to upgrade the existing virtual environment failed; instead I ended up installing HA into a new directory and copied over my old configuration files.

Edit: Removed the following line from the above which activates Python 3.6 globally and which is not necessary when installing HA in a cirtual environment:

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
1 Like

You’re right. I’ll fix that in the other post as well so that others don’t make that same mistake. Thanks for pointing that out.

Technically, if you’re using virtual environments, you shouldn’t need to use update-alternatives. To my understanding it might actually even damage your system. Just my 2 cents.

Yes, you’re right, that setting activates that Python version globally; not required when using virtual environments.

1 Like

Thanks for this, I’m in the same boat with Ubuntu 16.01.
Just to confirm, do I then need to be explicit for all commands? e.g. python3.6 -m pip install wheel or just python3 -m pip install wheel?

Consider using Docker. No big difference from a Python Virtual Environment to a Docker container, except Docker does not mess up your Python install.

  1. Install it for Ubuntu according do documentation.
  2. Run it using your current configuration (copy and paste):

docker run --rm --net=host --name="home-assistant" \
  -v /path/to/your/config:/config \
  -v /etc/localtime:/etc/localtime:ro \
  homeassistant/home-assistant:0.65.3` 

Next time a new Home Assistant version is released, stop the container (includes implicit removal)

docker stop hass

and run the above command again using the new release number. Infact, you can use any release number, so downgrade is easy as well. You could also use homeassistant/home-assistant:latest instead a version number to always get the latest released number.