How to upgrade virtualenv (virtual environment) to Python 3.7 on Ubuntu ( Ubuntu server 18.04 )

Just wanted to bump this up a bit. I finally got around to doing this tonight. Took 10 min or so and I had zero issues. I honestly was caught off guard by how well it went. Thank you very much for the easy to follow guide

One thing to note I had a few shell commands in my setup and could not figure out why they were not working anymore.

I have not fixed yet, but I’m pretty sure I need to change the command from

python3 /home/homeassistant/.homeassistant/python_scripts/lock_car.py

to

python3.7 /home/homeassistant/.homeassistant/python_scripts/lock_car.py

A big “Thank you!” to @Alexander_Stepanov and @markbajaj for their helpful instructions. I finally took the plunge and updated my production system from 0.89 to 0.103.2.

It was quite the leap but my test system was already running 0.103.2 (albeit with docker) so at least I knew the configuration changes I would need to make. What has caused me to procrastinate is that it the production system uses a venv and I wasn’t certain how to perform the python upgrade.

Anyway, the instructions helped me a great deal. The biggest glitch occurred when Home Assistant attempted to build the cryptography wheel and aborted. It referred to PEP 517 and after a search through the forum I found I needed to backtrack and do this:
sudo apt-get install libssl-dev
Afterwards, the second attempt to install Home Assistant ran without a problem.

Some more tweaking was needed to clean up my configuration file and then everything settled down to work nominally.

Thanks again!

1 Like

I’m trying to upgrade Python on my system (just installed a Fedora system that comes with Python 3.4.3) and have a silly question.

So I activated the environment and from within venv I try to run the first command

sudo apt update

Then I get a message about a password to the venv. Do I need to “logon” to this virtual environment? If yes, what’s the password? There was no step anywhere I can remember that asked me to create a password

The sudo command requires your userid password. You may not have a password for your homeassistant userid because you have not set a password.

whoami will show your userid.

Either set a password for your homeassistant user and put that userid into the sudoers group or exit back you your login userid and run apt commands from there.

2 Likes

Can I just thank you. These are more concise and complete directions that literally anywhere else that I have found.

1 Like

@Alexander_Stepanov I’m confused here, if you move the venv aren’t you just installing fresh HA here?

Basically, yes. But you’re pointing it to the same config folder, so it just starts up as if nothing happened. Same thing as when you upgrade a docker container.

Edit: “docket” —> “docker”

1 Like

my bad, i didn’t realised i installed in /srv/ that’s what confused me, thanks!