Hello all,
I am trying to create a custom component which depends on the python pandas library. I am using hass.io, so I am running home-assistant in a docker container.
I know that with hass.io, you need to install additional python dependencies in /config/deps. I use the custom-dependencies hass.io addon for that.
I am able to install pandas in /config/deps, but when HA tries to import it at boot, I get the following error:
Traceback (most recent call last):
File "/config/deps/lib/python3.6/site-packages/pandas/__init__.py", line 26, in <module>
from pandas._libs import (hashtable as _hashtable,
File "/config/deps/lib/python3.6/site-packages/pandas/_libs/__init__.py", line 4, in <module>
from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
ImportError: Error loading shared library /config/deps/lib/python3.6/site-packages/pandas/_libs/tslib.cpython-36m-x86_64-linux-gnu.so: Operation not permitted
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/sensor/tmpo.py", line 70, in setup_platform
session = FluksoTmpoSession(hass)
File "/config/custom_components/sensor/tmpo.py", line 262, in __init__
import tmpo
File "/config/deps/lib/python3.6/site-packages/tmpo/__init__.py", line 138, in <module>
import pandas as pd
File "/config/deps/lib/python3.6/site-packages/pandas/__init__.py", line 35, in <module>
"the C extensions first.".format(module))
ImportError: C extension: Error loading shared library /config/deps/lib/python3.6/site-packages/pandas/_libs/tslib.cpython-36m-x86_64-linux-gnu.so: Operation not permitted not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
It seems to be a problem to import the pandas library when it is installed in a PYTHONUSERBASE directory (/config/deps in this case). When I log into my running HA container, and I install the pandas library using pip there (not in the user directory /config/deps, but in the normal /usr/local/lib) I can import the pandas module without a problem.
Could you guys help me debug this problem?
BTW, I used hass.io on a rpi3 before, and there this procedure to install pandas was working. Now I am running hass.io on my own server.
This is the output of ldd for the shared library that fails to load:
/config # ldd /config/deps/lib/python3.6/site-packages/pandas/_libs/tslib.cpython-36m-x86_64-linux-gnu.so
ldd: /config/deps/lib/python3.6/site-packages/pandas/_libs/tslib.cpython-36m-x86_64-linux-gnu.so: Not a valid dynamic program