ERROR (Recorder) No module named '-sqlite3'

Hello, new to Home Assistant I followed the installation steps as described on its site for manual installation. It is a first installation and everything went on fine untill the last step. Invoking ‘hass’ gave a Recorder-error ‘No module named ‘-sqlite3’’ and secondly the MainThread-error ‘Could not set up all dependencies’. I’m using a Raspberry Pi 4 (2G) with the Raspberry Pi OS kernel 5.4 and have installed Python3.7 manually.
Did anybody have a similar experience, what went wrong?? I could not find a workable solution in the topics but of course I didn´t read all of them.
René

Use Home Assistant Container and say ‘no’ to Python dependency hell …

1 Like

First off, you should be on at least Python 3.8.6, if not Python 3.9

Secondly, this means you’re missing key system libraries. You can fix this when you install Python from source, but … HA Container is a better choice :wink:

1 Like

@Tinkerer @m0wlheld both of you thanks a lot! I just returned from some running and will try the HA container. One more question: flashing the container will erase all existing data including the Raspberry OS. So, does this mean that the HA container includes an OS for raspberry?

Containers are kind of „virtual machines“ for processes and their templates („images“) do contain a runtime environment for that process (not for the host).

Containers are ephemeral, everything that is not part of the image will be gone, once you delete the container.

That‘s the reason why HA config and runtime information will be persisted outside the container, in a directory on the host, that will be „mapped“ into the container‘s filesystem.

You can just install Docker and Docker Compose, and migrate your current install

  1. Install Docker (https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script)
  2. Install Docker compose ( sudo pip3 install docker-compose )
  3. Follow the docs to create your compose file and start the container

You can create the compose file, and the config folder for HA, anywhere you want. I’d suggest something like /docker for your compose file, and /docker/home-assistant for the config folder, so you know where things are. Then it’s also easy to back up all of /docker and get everything.

The migration is easy after that. Create the following docker-compose.yaml:

version: '3'
services:
  homeassistant:
    container_name: home-assistant
    image: homeassistant/home-assistant:stable
    volumes:
      - /home/homeassistant/.homeassistant:/config
    environment:
      - TZ=Europe/London
    restart: always
    network_mode: host

Replace the timezone with your timezone, and add any devices you need for Zigbee or Z-Wave. After that:

sudo docker-compose pull
sudo systemctl stop home-assistant@homeassistant
sudo systemctl disable home-assistant@homeassistant
sudo docker-compose up -d homeassistant

Shortly after that you’ll have HA running in Docker, as if by magic.

If you’ve got any integrations that refer to file locations then those will error, because the file locations have changed. A common one would be http for SSL.

@Tinkerer, step by step i’m getting my way thru Linux Terminal prompts. Indeed, Python has its complications as I could see the installation of Python3.8.7 was done but apparently in wrong directories. Anyway, I followed the steps as you described but it seems that in the docker-compose.yaml - text something is wrong. At least on ‘sudo docker-compose pull’ I get the ERROR Top level object in './docker-compose.yaml' needs to be an object not '<class 'NoneType'>'. Any idea??
René

I’d say … you’ve got an error in your compose file

But we don’t know what’s in there…

1 Like

Then, what should be in the ‘old’ (?) compose file for a first, new installation?

I feel like @Tinkerer wants you to post your docker-compose.yaml

You mean the one he suggested? That is the only one I have.
Anyway, I skipped a few steps and went straight to the command ‘sudo docker-compose up -d homeassistant’, assuming that no old file is there to ‘pull’.

But the docker-compose file in this post does not trigger that error. Just checked it by running docker-compose -f docker-compose.yml config.

No errors.

same with me, just checked it with docker-compose -f docker-compose.yml config. Does this mean that the only thing left is to start HA? If so, how?

sudo docker-compose up -d

then trace with

sudo docker-compose logs -f

Btw, you should get rid of that “sudo” requirement by adding your OS user account to the docker group.

I thought I did so already, will look into this later. But frankly, the warning statements didn´t feel comfortable . .

It seems i do have already a version of HA running (the docker container is already in use) but don´t see anything. I only have a connection with the Pi using PyTTY, could be the cause?

René,

we can’t see your screen, so whenever feasible post warning messages or other relevant output here, using the grafik button for formatting.

docker-compose up will read your docker-compose file and - if valid - prepare and start the services defined within.

For this it will:

  1. download (pull) the container images, if not already present in your local registry (here: homeassistant/home-assistant:stable)
  2. create directories, that are defined to become “volumes” inside the created containers (here: /home/homeassistant/.homeassistant)
  3. (re-) create container instances and start them, attaching the to the network defined (here: your host’s network).

If everything goes well, then you should be able to open Home Assistants Web-UI at http://homeassistant.local:8123/ or http://:8123/.

Every step can fail for various reasons and in that case, a message is printed to the console / your PuTTY session. Show it, please.

Assumption: During your tests you managed to create and run a Home Assistant container. That container instance is now blocking the creation of a new instance.

Some basics:

  • docker ps: show id, name, ports and other info of currently running containers

  • docker ps -a: same, but also include stopped containers

  • docker stop <container id or -name>: Stop a container

  • docker rm <container id or -name>: Remove a stopped container

  • docker logs <container id or -name>: Dump messages that has been sent to the container’s output

  • docker-compose config: Check file docker-compose.yaml file in same directory for validity

  • docker-compose pull: Download container images, that are defined for services inside compose file

  • docker-compose up: Pull images (if required) and (re-)start container instances defined as services in compose file. The command will not return but print log statements to console. If you want to terminate, press ctrl-c. For productive use, add -d parameter for a detached start

  • docker-compose down: Stop and remove container instances, that are defined for services in compose file

  • docker-compose logs -f: Show and trace logging output for all services defined in compose-file. Add a service-name (here: homeassistant) to limit log output for that service. Press ctrl-c to stop tracing

Hope the helps.

1 Like

Hmm, everything seems to work already and I have access to the welcome screen of HA through http://192.168.2.6:8123. Thank all of you for your patience with this newbee.
René

1 Like

Yet another question. The inlog site for HA is requesting a valid username and password. However, for HA I never made an account. I only have usernames and passwords for the pi and for this forum ('community.home-assistant.io´), both of them of course of no use to log in on HA. Also the default username and password for rp4 (pi and raspberry) do not work. What to do, I do not see anything to register?

Creating a new user is the first step during onboarding. Sure you didn‘t?

If you did not anything with HA yet (which you obviously can‘t, because of missing credentials)

  • clear directory /home/homeassistant/.homeassistant, including the hidden .storage directory
  • call docker-compose restart homeassistant
  • log into http://192.168.2.6:8123/ and restart onboarding

I deleted the .homeassistant directory, still doesn´t work: