Run pip install in docker hass


I’m trying to setup a docker image with hass on my rpi

In order to get de nefit plugin to work, I need to run in de python env:

pip install nefit-client

How can I do this in the docker image???

regards Richard

1 Like

Build HA docker image that includes it. Then create container with that image

If possible, you can also run nefit plugin in a separate docker container and connect to that to HA

1 Like

Is there a default manual/instructiions how to create a docker for hass?? So that I can do an extra pip install nefit-client

regards Richard

See the dockerfile here: To install additional packages just append them onto the end of the pip3 install like so:

RUN pip3 install --no-cache-dir -r requirements_all.txt && \
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop cchardet cython netfit-client

in docker hass you can only install APK

You should be able to create a new image by creating a Dockerfile containing

FROM homeassistant/home-assistant

RUN pip install nefit-client

and then run

docker build -t my_ha:0.68.1 .

But I just tried it and nefit-client seems to need more dependencies installing, so I didn’t follow on further.

I think it should be pip3 install nefit-client,

Collecting nefit-client
Downloading 1 -0.2.2-py3-none-any.whl
Collecting pyaes (from nefit-client)
Downloading 1 e-any.whl
Collecting sleekxmpp (from nefit-client)
Downloading 1 -py3-none-any.whl (434kB)
100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 440kB 636kB/s
Installing collected packages: pyaes, sleekxmpp, nefit-client
Successfully installed nefit-client-0.2.2 pyaes-1.6.1 sleekxmpp-1.3.3

1 Like

If I want to change de dockerfile

Can I put it localy on my rpi and run the install docker command, but can I tell it to use de local dockerfile with an option?

docker run -d --name=β€œhome-assistant” -v /path/to/your/config:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/raspberrypi3-homeassistant:0.68.1

I’ve got it working in HassIO using the following procedure:

Enable SSH access as described in

Then SSH to hassio.local
ssh [email protected] -p 22222

#run shell in homeassistant docker containter
docker exec -it homeassistant /bin/bash

define user base directory

export PYTHONUSERBASE=/config/deps
#install pyaes
pip3 install --user --no-cache-dir --prefix= --no-dependencies pyaes
#install nefit-client 0.2.2

0.2.5 didn’t work for me, got certificate expired messages

pip3 install --user --no-cache-dir --prefix= --no-dependencies nefit-client==0.2.2