Python upgrade

I have problem with phyton version
how to upgrade it in my virtualenv? please someone can give me exact code? I am noob.
I upgrade pyton on pi
pi@raspberry:~ $ python --version
Python 3.7.3

but I had always message on my homeassistant page:

What type of Home Assistant installation? If you are running in a virtual environment, python needs to be updated there.

Any information I found says to backup Home Assistant then delete HA & the venv, and rebuild with the updated version of Python.

I think it is in virtualenv…
I have no idea how to delete and rebuild…
It sounds very hard to do for me…
isn’t the possibility to upgrade python in virtualenv instead of do this?

One advantage of the venv is that system version upgrades do not affect the HA environment. In this case it is also a liability.

Ok but is there a guide for it?

If you installed Hassbian, the instructions are here.

1 Like

I think you need to create a new Virtual Environment and it will inherit the new python version. Google is your friend - I don’t use venv.

You use Docker then?

Yes docker. Debian+docker+hass.io

@anon34565116 I have to admit I’m a little lost on upgrading my Python version too. Just read the release on 0.94 and noticed the remarks on Python version deprecation.

I too am running in the venv on Python 3.5.3 so to move on to Hass 0.94 I’m going to have to bite the bullet.

I did a quick search and this post didn’t fill me with too much promise either How do I upgrade python3 version in venv

I do understand this community is NOT a help desk but I’m wondering has anyone successfully upgraded a version of Python while using Hass in a venv. If so could they give me some pointers on how they achieved this.

My install is currently on a Raspberry Pi3 running Raspbian Stretch Lite.

Silly question but would it be easier to reinstall Hass from scratch and copy over the config files. Of course it would depend on what version of Python is currently in the Raspbian Stretch repos.

3 Likes

Yeah that won’t help… I made a new raspbian lite install this week (d/l latest image and upgraded fully) for another purpose and it’s python 3.5.3…

1 Like

As I thought. Now that would have been too easy :sob:

I followed this guide, but substituted 3.7.3 instead of 3.6.x

I saw that but surely that would universally install Python across the whole distribution.

Just found this snippet from another post

sudo systemctl stop [email protected]
cd /tmp
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
tar xzvf Python-3.7.3.tgz
cd Python-3.7.3/
./configure
make -j 4
sudo make install
python3 -V
python3 -m pip install --upgrade pip
sudo systemctl start [email protected]

Does this method sound familiar to anyone.

2 Likes

I did a quick look at the Hassbian script. It grabs Python directly instead of using the version installed in its Raspian OS.
It appears the devs have decided to make everyone slaves to their custom environments in Docker and Hassio. That is really a shame.
The devs use the excuse that the next stable Debian will have 3.7 but there is currently no release date for that.

1 Like

Not really. If you use Hassbian then you need the skills to update python there… most people insist on using hassbian because they like the control they feel they have so with great power comes great responsibility.

Docker is incredibly easier to manage anyway even for the control freaks and you don’t need to worry about any dependencies.

1 Like

Are we down to a Docker/Hassio only choice now.

I’m on Hass venv 0.93.2 so unless I get the Python situation sorted I’m frozen in time.

I looked at a Hassbian image earlier but it states that it’s Debian Buster version and comes with a health warning :warning:

Because it’s a pre-release no doubt.

I upgraded 2 Pi’s yesterday to Python 3.7.3 - I did get a few dependency issues but fairly simple fixes when you Google the error.

According to your first post, you already have Python 3.7.3 now so why not just follow the instructions for installation from the point where you create a new virtual environment… I don’t think you need to upgrade the existing one -just make a new one? Although as I say, I don’t use venv.

If there is a hassbian image with 3.7.3, maybe backup your config yaml files and use a new card, see how that goes. I remember the last time they depreciated a python version the advice was to start again! Made me glad I was using docker TBH.

No I mentioned my install contains Python 3.5.3. That’s the reason why I need to upgrade it as per advice in the HA 0.94 release notes.

Looks like I’ll need to keep digging but maybe in the meantime someone who has Hass venv installed and has upgraded their Python version will pitch in with their experiences.