Upgrade to Buster and Python 3.7.3

Hi

A few hours later and I have Buster installed and Python Upgraded to 3.7.3 if like me your running home assistant on a Pi with virtual environment you may find this useful to save some time or if your going for a fresh install of Buster and Home Assistant under Python 3.7.x.

No doubt you will get errors and dependencies that are specific to your set up but this may be of use to cut out some time and bite the bullet and upgrade to stop the notification on the newer home assistant installations.

I tried my best to copy and paste actions as I went through this so I could save time on my other Piā€™s. Iā€™ll probably get this system fully functional and just image it to another SD then copy and change config and lets encrypt files for my other installs/domains on my other Piā€™s.

I always backup .homeassistant directory with all the config files and make an image of the current setup with Win32DiskImager! Things can go wrong so beware. Although I was pleasantly surprised no major issues!!

Iā€™m running Home Assistant in this location- srv/homeassistant/homeassistant_venv with my config in
home/homeassistant/.homeassistant

First Buster with Python 3.7.3;

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade

Then manually edit the following files, and change everywhere listed as ā€˜stretchā€™ to ā€˜busterā€™ and save the files.

/etc/apt/sources.list and /etc/apt/sources.list.d/raspi.list

Then run again;

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade

press q when it comes to the end for quit, carries on with install`

I said ā€˜n (no)ā€™ to keep existing config files as they came up through the install as I wanted my configs

Then reboot and you should have Buster and Pythonā€¦

Then you have to create a new venv, using Python 3.7 Use the same method that you used originally but for me I first renamed the old one,

You can check Python version with python3 ā€“version (should be 3.7.3 or whatever Buster has)

Then move old virtual environment;

mv homeassistant homeassistant.old

I was missing venv package so ran that first and then created a new venv, activated and installed homeassistant; (there were errors running the last command, I worked round these);

Sudo apt-get install python3_venv
python3 -m venv homeassistant
source bin/activate
python3 -m pip install homeassistant
hass --open-ui

Home assistant wouldnā€™t start correctly as modules were missing, I needed some keys for these;

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138

Ran another;

then sudo apt-get update
sudo apt-get upgrade

Had an issue with pip so installed easy install (if havenā€™t got already sudo apt-get install python3-setuptools or google) and ran;

sudo easy_install pip

I froze old Venv and created requirements.txt

source /srv/homeassistant_old/homeassistant_venv/bin/activate
pip3 freeze ā€”local > ~/requirements.txt
deactivate

Install requirements new Venv;

source /srv/homeassistant/homeassistant_venv/bin/activate
pip3.7 install -r requirements.txt

Have any issues with errors on the above find the file home/pi/requirements.txt and take out the lines where those modules are causing an issue and re save. I had python-apt==1.8.4 so removed it.

I had an issue with PyGObject so ran;

apt-get install libcairo2-dev

Then keep running until no errors in the Virtual environment, the order of things I needed were below;

pip3.7 install -r requirements.txt
sudo -H pip3 install setuptools ā€“upgrade
sudo -H pip install setuptools ā€“upgrade
sudo apt install libgirepository1.0-dev
pip3.7 install -r requirements.txt
sudo reboot

I found the homeassistant status command useful throughout for errors or if homeassistant was running

systemctl status [email protected] -l

or the log as it loads;

tail -F /var/log/syslog 

or check the log out at home/homeassistant/.homeassistant/home-assistant.log
or the system log at
var/log/syslog

Always make sure when compiling HA I was in Virtual Environment;

source /srv/homeassistant/homeassistant_venv/bin/activate

I had no front end module so;

pip install home-assistant-frontend

I needed to change the open zwave directory in my home/homeassistant/.homeassistant/configuration.yaml

zwave:
  usb_path: /dev/ttyACM0
  config_path: /srv/homeassistant/homeassistant_venv/lib/**python3.7**/site-packages/python_openzwave/ozw_config

And as per my last python upgrade there is some messing around with running commands and tts but nothing you canā€™t google and correct if they are an issue. I removed/reinstalled pulseaudio / mplayer/ vlc-bin / omxplayer and the libraries. I followed something I did on here previously for Bluetooth (out of date to a degree for that now). Iā€™m using the 3.5mm jack so ensured that was activated in raspi-config

I deleted home/pi/duckdns folder and reinstalled duckdns from the install instructions for a pi on the duckdns website against my domain name as I was getting HTTP/SSL errors but they seem to now be gone, that was an error like this

https://community.home-assistant.io/t/log-error-ssl-handshake-failed/93236

Iā€™m still having an issue with playing mp3ā€™s but thatā€™s my set up and may not affect others, Iā€™ll figure that out.

But log looks good (zwave socket and orvibo were unplugged and I still have emulated hue in config);

2019-11-09 11:52:49 WARNING (MainThread) [homeassistant.components.emulated_hue] Emulated Hue running in legacy mode because type has been specified. More info at https://xxx
2019-11-09 11:53:01 ERROR (SyncWorker_10) [homeassistant.components.orvibo.switch] S20 at 192.168.1.201 couldn't be initialized
2019-11-09 11:53:46 WARNING (MainThread) [homeassistant.components.zwave] Z-Wave node 36 not ready after 30 seconds, continuing anyway
2019-11-09 11:53:53 WARNING (MainThread) [homeassistant.components.zwave] Z-Wave entity Unknown Node 36 Switch (node_id: 36) not ready after 37 seconds, continuing anyway

At last got sound for mp3ā€™s and tts working.

I think my key was adding users pi and homeassistant to pulse access;

In the file /etc/pulse/daemon.conf make the daemon ā€œsystem-wideā€ so it is active for the whole system:
change to system-instance = 1

Added users pi, home assistant to the groups pulse , pulse-access.

sudo adduser pi pulse
sudo adduser homeassistant pulse
sudo adduser pi pulse-access
sudo adduser homeassistant pulse-access
5 Likes

Why do you people keep doing things like that? It takes two lines to run Home-assistant in Dockerā€¦

Why do you people keep (bother) replying like that, personally I would explain what you mean and how that merits having HA the way you have it set up rather than as above. Comments like that are un-constructive, after some effort to try and save others time as there were other posts that didnā€™t work. Makes me wonder why I bother :rage:

2 Likes

You do it because people appreciate it. @m0wlheld, better manners please.

2 Likes

Dont worry about the naysayers, Iā€™ve had significantly less issues with venv since moving to it, and I see many more issue with docker upgrades frequently (though I suspect in part that is to do with the lower number of users with venv vs docker). Would be good to see a poll of numbers of venv vs docker vs hassio.

I didnā€™t have any issues with dependencies going to Buster but then I was already on python 3.7.

Hi @dingleydell: any chance you can also do a similar description of how to upgrade from 3.7.3 to 3.8.x?

1 Like

Hi @raoul.teeuwen: I have followed these easy to follow steps from [igorlemos] to upgrade to Python 3.8.6 after upgrading to Buster: Update Python to the new version 3.9
Iā€™ve had no problems since! Tested very much OK with HA 0.116.4. Donā€™t be mislead by the title and use 3.8.6 and not 3.9.

1 Like