Manual installation fail at "python3 -m venv ." command

Hello everyone,

another new user that fail to install ^^

I chose the manual install (new at raspberry and HA, and don’t want and have a flash card)

So I follow the manual installation. But i failed at the “python3 -m venv .” step

here is the message : “Error: Command ‘[’/srv/homeassistant/bin/python3’, ‘-Im’, ‘ensurepip’, ‘–upgrade’, ‘–default-pip’]’ returned non-zero exit status 2.”

Please note It is the second time I tried to install HA. First time fail, so I delete /srv and / home home assistant directory.

Maybe something was not make properly ?

I should restart again, but how to “clean” uninstall or purge?

I assume you’re trying to follow this guide?

Please describe the system that you’re using: which Raspberry Pi, and what operating system does it have on it already? What do you mean by “and don’t want and have a flash card”?

Are you planning for Home Assistant to be the only thing running on the Pi?


Sorry, I didn’t give much details.

-Yes I use this guide
-Raspberry 3
-Note sure, but it’s Raspbian
-I plan to use the raspberry for HA and to be a player for casting music

I only have the SD card given at the purchase, but I don’t know if the operating system run on it (I very new to Raspberry and Linux).

So when I saw, you have to flash a SD card for installing HA, I thought I should not flash this car, so I preferred use the manual install. In deed, it could be a could way to learn and understand “linux” command line

That suggests that the python3 interpreter is already the one in the virtualenv, which shouldn’t be created until after this step. Are you sure that 1. you completely deleted the /srv/homeassistant/ folder after your first attempt and 2. you’re following the guide in the correct order?

What does this command give?

which python3

When I tried again an install, I manually delete /srv/homeassistant and /home/homeassistant folders (with rm, because of permission problem)

Yes, I follow step by step. But At the second time, some step are already “done” : for example, I don’t have to create homeassistant user (already exist by my first attempt)

Here is the output of the command :
[email protected]:~ $ which python3

Thanks for your help

I’d format your SD card and start again by installing Raspbian and then install HA.

I’m guessing that as you are new to Linux and HA you possibly bought a Raspberry Pi kit which included an 8gb NOOBS SD card. Is that the case.

Yes I bought a starter kit with 16 GB card (surely NOOBS).

There’s a number of specialised partitions on the Noobs card that may be causing your issue.

I suggest getting another SD card, format it and install the latest version of Raspbian Pi OS Lite from here

From there you should have no problem installing HA in the Venv as per these instructions

So, indeed, I should install Raspian lite without Noobs ?

Yes. You could format that Noobs SD card to clean it off completely or if you want to keep the Noobs partitions intact use a different SD card. There’s no doubt that the Noobs card in its current condition is causing your HA installation issues.

So I format the same card with another imager. Install Raspbian lite, and the install of homeassistant was successful


1 Like

You’re welcome :wink:

I loosed my politeness.

Thank you :wink:

No offense, but if you are new to HA and linux, I’d strongly advise to NOT use the manual install in a venv and rather use the image or install HA supervised on Raspbian lite. With a venv you need to maintain the system yourself, upgrade python version from time to time, check and fix depencies once in a while, etc., which is not extrwmly hard but can get frustrating for a beginner very fast (I was there). Also with a venv you don’t get all the fancy add-ons, built-in backup function, automatic updates etc., which are all very handy, especially for a beginner.

I started HA with the venv three years ago and still working away nicely.

There’s pros and cons for each install method and like the OP I came across the venv install purely by accident and haven’t looked back.

There’s plenty of experienced users on the forum who will only be too happy to point him in the right direction and if he finds in time this setup is not for him he’s lost nothing and probably learnt a little on the journey.

The main thing is he’s resolved his installation issue and is up and running with HA.

I also started with a venv at around the same time and switched to core in docker later.

That’s generqlly true, but you can expect way more help with other install methods as venv is probably the least used method (I know development is done with the venv method, but to be honest I don’t see a lot of core devs who are very actively providing support in the forums).

I just wanted to save OP some time, because he will for sure need a lot more time to learn HA with a venv than with a supervised install, especially without prior knowledge of linux or HA. Also I’m not sure whether OP is aware that there are no add-ons for venv and that he needs to setup things himself to get the same functionality. I don’t want to say venv is a bad method or anything like that, but it’s for sure not the most user friendly method.

Totally agree.

Yes there’s no one size fits all with HA. I’m glad I went the venv route. One thing is for sure. It’s still here as an installation method.

All I did was address the OP’s issue. I generally don’t recommend one preference over another unless I’m asked to. Had the subject been “which is the easiest way to get started with HA”…well that would have possibly been a different answer.

Maybe the OP will be back soon asking the very same question…who knows.

1 Like

Thank you for sharing your knowledge. It always be useful

Juste few questions

-The default install, is to flash a SD card with HA, and install the image.
Since the OS Raspbian is store on the SD card (I suppose), what does imply to do the default install (retire OS card, and puting “HA” image install) ?
Is that mean my pi dedicated only ta HA and nothing else ?

That’s the reason why I choose venv, because I don’t find explanation to these questions

By using verV, So if I want to install add on, it can be to hard ?

The docker way use to be an another option I looked. But I’m not sure to well understand.

I come from industrial automation, dockers, Mqtt start to be use. I don’t know for the us, but in Europe, industry field technology is moving very slowly (There is less than 10 years, web server was a discover for some industrial !).
So I discover step by step (because evolution should not be fear) , And maybe I’m on a bad way for HA. But I will learn from my mistakes.

Wow you were back a bit quicker than I anticipated :joy:

In the Venv you add platforms. A quick Google will show you exactly how many are available. Here’s a link to a demo you can add to your config yaml to see how they work

Yes you can still use your SD card for other tasks as well as HA in the Venv setup.

Your best friend here is the community forum as well as Google. The resources are vast. As you come from a technical background I doubt the Venv will faze you one bit, but you need to search and don’t be afraid to ask questions

Maybe I‘m not using well google ^^

That’s the point I don’t understand. Maybe I’m totally wrong : if I retire the SD card from my pi, so there is no Raspbian on my pi ?

I admit that the SD cars is the storage of the raspberry.

If my statements are true, so I still not understand how HA could be install from the image on SD card I put into The pi.

I’m going to read your link .