How to compile esphome on a Pi 3

Today I wanted to add a wemos d1 mini with ds18b20 temperature sensors to home assistant. So, after installing the add-on I fired off the compilation for my new device (just the default config).

However a few minutes into the compilation home assistant just crashed.
From google I found the following 2 pages.
1: My issue.

2: Looks quite similar

So from what I understood is that a Pi 3 simply does not have enough RAM to compile esphome. Now I could try to increase the SWAP space as described here but that does not “feel” right.

Can someone tell me how I can compile this or do I simply have to wait for my home assistant yellow and place my Pi 4 with 4GB or RAM in order to make this work?

The equipment I have:

  • Chromebook (with Linux and Android)
  • Windows laptop
  • Pi 2

Can I run the compilation on one of those or do I really have to wait?

You can use the chromebook or the windows laptop.

personally I do increase the swap file with 2GB, and yes, I’m waiting for the yellow as well :wink:

before that, I compiled with windows, that was about a year ago, So I can’t give you any hints right now.
but it’s possible

What I know is, Increasing the swap file and deploying from HA is way easier.

1 Like

Hi,

I have the same challenge: HA with ESPHome running on RPi 3 with 1 Gb RAM and a Chromebook with linux. Thought to find a solution to ESPHome crashing HA here…

Is there a solution?

Have you tried increasing your swap?

Also try setting compile_process_limit to 1

I did set compile_process_limit to 1 and was able to compile twice but ran into HA hanging after that multiple times. Did not increase swap because I preferred to try compiling on my Chromebook which succeeded, As I could not find clear instructions how to do so I will share what I did:

  • Set up Linux on your Chromebook
  • Start the linux console

To install the esphome package in a python virtual environment:

  • Make sure you have python3-full installed
  • Create a directory for your virtual environment(s) if it does not exist yet. Lets call it “path/to/venv”
  • Create a dedicated virtual environment for esphome:
python3 -m venv path/to/venv/esphome
  • Change directory into the new virtual environment:
cd path/to/venv/esphome
  • Install esphome in the virtual environment, using the venv’s pip3:
bin/pip3 install esphome
  • You can now run esphome in the venv:
bin/python bin/esphome --help

To make esphome easily accessible from any directory:

  • Create a “bin” directory in your home directory if it does’nt exist
  • Ensure this bin directory is on PATH, for instance by logging out and in
  • Create a file in the bin directory called “esphome” with the following contents:
#!/bin/bash

/full/path/to/venv/esphome/bin/python /full/path/to/venv/esphome/bin/esphome "$@"
  • make this script executable:
sudo chmod u+x esphome

Now you can start using esphome:

By making esphome a bash script in a directory on PATH (~/bin) it can be executed from anywhere. The yaml file you want to compile can thus be stored anywhere.

Navigate to your directory of choice, create a yaml file here and do what you want with esphome, for instance:

esphome -h
esphome config my_first.yaml
esphome run my_first.yaml