Problem
Thanks, we already found the problem. It is reproduceable by issuing:
root@Framboise1:~# su - kotori
kotori@Framboise1:~ $ /opt/kotori/bin/python
>>> import kotori.daq.application.mqttkit
[...]
File "/opt/kotori/lib/python2.7/site-packages/influxdb/client.py", line 16, in <module>
from influxdb.line_protocol import make_lines, quote_ident, quote_literal
File "/opt/kotori/lib/python2.7/site-packages/influxdb/line_protocol.py", line 12, in <module>
from pytz import UTC
ImportError: No module named pytz
Looks like the early Kotori 0.15.0 package lacks this dependency.
Investigation
We expected a simple
kotori@Framboise1:~ $ /opt/kotori/bin/pip install pytz
to work by just installing the pytz
package.
pip
itself is broken
However, the attempt to install the pytz
package yields another error like
Traceback (most recent call last):
File "/opt/kotori/bin/pip", line 7, in <module>
from pip import main
File "/opt/kotori/lib/python2.7/site-packages/pip/__init__.py", line 73, in <module>
from pip.util import get_installed_distributions, get_prog
File "/opt/kotori/lib/python2.7/site-packages/pip/util.py", line 20, in <module>
from distlib import version
File "/opt/kotori/lib/python-wheels/distlib-0.1.9-py2.py3-none-any.whl/distlib/version.py", line 14, in <module>
File "/opt/kotori/lib/python-wheels/distlib-0.1.9-py2.py3-none-any.whl/distlib/compat.py", line 31, in <module>
ImportError: cannot import name HTTPSHandler
By following python - ImportError: cannot import name HTTPSHandler using PIP - Stack Overflow we also found that
import ssl
would also error out like
kotori@Framboise1:~ $ /opt/kotori/bin/python -mssl
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: libssl.so.1.0.0: cannot open shared object file: No such file or directory
So we conclude binary compatibility between Debian Jessie and Debian Stretch is not given due to conflicts regarding the OpenSSL version. In turn, this breaks pip
completely.
Damn. We really should provide packages built on/for Debian Stretch.
Solution
So, let’s just download the single missing package pytz · PyPI from PyPI:
su - kotori
cd /tmp
wget https://files.pythonhosted.org/packages/af/be/6c59e30e208a5f28da85751b93ec7b97e4612268bb054d0dff396e758a90/pytz-2018.9.tar.gz
tar -xzf pytz-2018.9.tar.gz
cd pytz-2018.9/
and install it using the basic Python package setup mechanism without even touching pip
at all:
/opt/kotori/bin/python setup.py install
Installed /opt/kotori/lib/python2.7/site-packages/pytz-2018.9-py2.7.egg
Processing dependencies for pytz==2018.9
Finished processing dependencies for pytz==2018.9
Proof
Start Kotori ad hoc in the foreground
su - kotori
/opt/kotori/bin/kotori --config /etc/kotori/kotori.ini
2019-03-02T03:09:33+0100 [kotori.core ] INFO: Enabling applications ['hives']
2019-03-02T03:09:33+0100 [kotori.core ] INFO: Starting application "hives"
2019-03-02T03:09:39+0100 [kotori.daq.graphing.grafana ] INFO: Starting GrafanaManager "GrafanaManager". grafana=localhost:3000
2019-03-02T03:09:39+0100 [kotori.daq.services.mig ] INFO: Starting MqttInfluxGrafanaService. name=service-mig-hives, channel={'realm': 'hives', 'mqtt_topics': 'hives/#', 'enable': 'true', 'type': 'application', 'application': 'kotori.daq.application.mqttkit:mqttkit_application'}
2019-03-02T03:09:39+0100 [kotori.daq.intercom.mqtt.base] INFO: Starting PahoMqttAdapter. name=mqtt-hives, broker=localhost:1883, object=<kotori.daq.intercom.mqtt.paho.PahoMqttAdapter object at 0x74319950>
2019-03-02T03:09:39+0100 [kotori.core ] INFO: Enabling vendors []
2019-03-02T03:09:39+0100 [kotori.daq.intercom.mqtt.paho] INFO: Subscribing to topics [u'hives/#']. client=<paho.mqtt.client.Client object at 0x74319b90>
2019-03-02T03:09:39+0100 [kotori.daq.intercom.mqtt.paho] INFO: Subscribing to topic 'hives/#'
2019-03-02T03:09:41+0100 [kotori.daq.services.mig ] INFO: [hives ] transactions: 0.00 tps
[...]
CTRL+C
Restart Kotori service
root@Framboise1:~# systemctl restart kotori
root@Framboise1:~# tail -F /var/log/kotori/kotori.log
2019-03-02T03:17:33+0100 [kotori ] INFO: Starting Kotori version 0.15.0
2019-03-02T03:17:33+0100 [kotori ] INFO: Using configuration file /etc/kotori/kotori.ini
2019-03-02T03:17:33+0100 [kotori.core ] INFO: Enabling applications ['hives']
2019-03-02T03:17:33+0100 [kotori.core ] INFO: Starting application "hives"
2019-03-02T03:17:34+0100 [kotori.daq.graphing.grafana ] INFO: Starting GrafanaManager "GrafanaManager". grafana=localhost:3000
2019-03-02T03:17:34+0100 [kotori.daq.services.mig ] INFO: Starting MqttInfluxGrafanaService. name=service-mig-hives, channel={'realm': 'hives', 'mqtt_topics': 'hives/#', 'enable': 'true', 'type': 'application', 'application': 'kotori.daq.application.mqttkit:mqttkit_application'}
2019-03-02T03:17:34+0100 [kotori.daq.intercom.mqtt.base ] INFO: Starting PahoMqttAdapter. name=mqtt-hives, broker=localhost:1883, object=<kotori.daq.intercom.mqtt.paho.PahoMqttAdapter object at 0x740f3b90>
2019-03-02T03:17:34+0100 [kotori.core ] INFO: Enabling vendors []
2019-03-02T03:17:34+0100 [kotori.daq.intercom.mqtt.paho ] INFO: Subscribing to topics [u'hives/#']. client=<paho.mqtt.client.Client object at 0x740f3dd0>
2019-03-02T03:17:34+0100 [kotori.daq.intercom.mqtt.paho ] INFO: Subscribing to topic 'hives/#'
Enjoy!