Q: NumPy/SciPy and HASS.io

Hi !

I’m need to use NumPy/SciPy in my project with hass.
What is the best way to best way to do it?
Since hass runs as docker container direct call to host OS functions is not possible (need some workaround I believe).

If I install NumPy as dewcribed by orenitamar (github) on Alpine:

Add py-numpy, since directly installing with pip doesn't work.
RUN apk add py-numpy
In the next step install it with pip.
RUN python -m pip install numpy

ENV PYTHONPATH=/usr/lib/python3.7/site-packages

will hass upgrade from web interface keep these changes, or it overwrites whole hass.io docker content?

Thanks in advance for any help.

Are you creating a HA integration? If so, all you should have to do is to list numpy in the manifest.json file as a requirement. E.g., see the manifest.json file for the trend binary sensor:

Did you get scipy working? I’m trying to install scipy, but it fails…

If anyone searches this topic, I got scipy working.
I installed scipy in docker via alpine package and symlinked the library to home assistant library.

Log in to docker:

  1. docker exec -it homeassistant /bin/bash
    In docker:
  2. apk add py3-scipy (If this won’t work, try py-scipy)
    Create symbolic link:
  3. ln -s /usr/lib/python3.10/site-packages/scipy /usr/local/lib/python3.10/site-packages/scipy

Integration should now find scipy by just importing it. Do not use “scipy” -requirement in manifest.json