Problems installing esphome

I’m trying to install esphome on the same Pi as I have home assistant running.
HA is installed with Hassbian.
I move inside the virtual env and try to install esphome with pip install esphome and the process starts but I get an error and it is not installed.

(homeassistant) pi@hassbian:~ $ pip install esphome
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting esphome
  Downloading https://files.pythonhosted.org/packages/b7/b2/4849b6abd4dae93cb0d1b3f2ca8dc569869d6d42cbc23ddbb56e19c39cb9/esphome-1.12.1-py2.py3-none-any.whl (539kB)
    100% |████████████████████████████████| 542kB 584kB/s
Collecting pyserial<4,>=3.4 (from esphome)
  Downloading https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl (193kB)
    100% |████████████████████████████████| 194kB 623kB/s
Collecting protobuf<3.8,>=3.7 (from esphome)
  Downloading https://files.pythonhosted.org/packages/41/7c/6029e1b37ca730648a22502d75e2c7707da7a207db1b366f76edc5a01a0b/protobuf-3.7.0-py2.py3-none-any.whl (404kB)
    100% |████████████████████████████████| 409kB 256kB/s
Collecting PyYAML<6,>=5.1 (from esphome)
  Downloading https://files.pythonhosted.org/packages/9f/2c/9417b5c774792634834e730932745bc09a7d36754ca00acf1ccd1ac2594d/PyYAML-5.1.tar.gz (274kB)
    100% |████████████████████████████████| 276kB 384kB/s
qRequirement already satisfied: paho-mqtt<2,>=1.4 in /srv/homeassistant/lib/python3.5/site-packages (from esphome) (1.4.0)
Collecting platformio>=3.6.5 (from esphome)
  Downloading https://files.pythonhosted.org/packages/f1/92/202b47ed8b4e8dcef98a74426dbffa139d10d11f01a10fe6fc98728fbade/platformio-3.6.5.tar.gz (112kB)
    100% |████████████████████████████████| 112kB 622kB/s
    Complete output from command python setup.py egg_info:
    PlatformIO Core v3.6.5 does not run under Python version 3.5.3 (default, Sep 27 2018, 17:25:39)
    [GCC 6.3.0 20170516].
    Minimum supported version is 2.7, please upgrade Python.
    Python 3 is not yet supported.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-21l38dsv/platformio/
You are using pip version 18.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

If I try to install it outside of the virt env I get an error telling me pip isn’t installed.

Can anyone please help me, what is the best way to install it on the same Pi as HA?

try using docker and avoid all the dependency issues, below is my docker-compose file

   esphome:
     container_name: esphome
     image: esphome/esphome-armhf
     ports:
       - "6052:6052" 
     volumes:
       - /opt/docker/esphome/config/:/config:rw

not really a solution…I don’t use docker, nor do I really wish to move to docker

1 Like

Upgrade your Python, but docker really easy

    PlatformIO Core v3.6.5 does not run under Python version 3.5.3 (default, Sep 27 2018, 17:25:39)

according to python --version the python version in the virtual environewmt is 3.5.x
I think esphome supports up to 2.7.
correct?
So id have to downgrade python?
If im wrong (I usually am :joy::man_shrugging:) is it safe to upgrade the python version inside the virt enc that HA is installed?

I’ve installed pip outside the virt env, and seeing if esphome will install, I think this is probably not the best route though?

you can check this post how to upgrade python correctly

thanks for the link.

I installed pip outside the virtual env with sudo apt install python-pip
then installed esphome with pip install esphome
when I try to use it I get the -bash: esphome: command not found error

you should run the command ‘esphome’ in your virtual env only - did you login as that user?

source /srv/esphome/bin/activate if that’s the location where you installed it.

Maybe im not clear…I installed (or meant to) esphome outside of the virtual environment

So I’ve managed to get it running, I think.
Bit the compiling took a long time, and I got an error, with no .bin file created

Segmentation fault
*** [.pioenvs/sensornodelounge/firmware.bin] Error 139
====================== [ERROR] Took 3895.02 seconds ======================

Any ideas at all?

maybe memory issue or try with a reboot
close apps/addons that you don’t need

I’ve only got home assistant and ESPhome running.
Just trying another compile, if it fails I’ll reboot the pi.

Here’s my 5p

don’t you have to use pip2 instead of pip? i though it needed python 2.7 to work

i see at the top it says pip, but other stuff says pip2
try pip2
pip2 install -U esphome is what you use to upgrade it

I think this is what is confusing me a little, all the documentation on the official site says to use pip, yet a little googling refers to pip2
As far as I can see it needs to run with python 2.7, and so older versions wont run it.
Ive tried to run a compile with python2 -m blahblah.yaml compile but get the segmentation error as seen in a post above, a reboot of the pi didn’t help

thanks for the link, interesting.
I think for the ‘safety’ of my home assistant instance, I will not try to mess to much on this Pi, so ill try and get another Pi I have laying about set up as a dev machine.
In your link you mention installing Python 2, but this comes pre-loaded on Raspbian stretch (lite) right?

Safest and quickest way without messing your system is working with Docker as suggested.
Takes less than 15min to setup docker.

So true! All these problems disappear with docker and once you use docker you will never have any desire to revert…

I can see you’re a fan of docker, but my setup does not include docker, and tbh im not prepared to overhaul my entire eco-system. Appreciate the input though