Habapp install doesn't install dependencies or create directories

(habapp) openhabian@pi-shop3:/opt/habapp $ sudo python3 -m pip install habapp
[sudo] password for openhabian:
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting habapp
  Using cached https://files.pythonhosted.org/packages/cf/70/2f72081a2f2301bda6d443d4580ab47eb2b01f5192dfbc39e0a27890ccef/HABApp-0.31.0-py3-none-any.whl
Collecting pydantic==1.8.2 (from habapp)
  Using cached https://files.pythonhosted.org/packages/ff/74/54e030641601112309f6d2af620774e9080f99c7a15742fc6a0b170c4076/pydantic-1.8.2-py3-none-any.whl
Collecting paho-mqtt==1.5.1 (from habapp)
  Using cached https://www.piwheels.org/simple/paho-mqtt/paho_mqtt-1.5.1-py3-none-any.whl
Collecting watchdog==2.1.2 (from habapp)
  Using cached https://files.pythonhosted.org/packages/ad/9e/df37da9de16e02d8a4230dcd09d4bf7ced6cd97e1f421cbade133a011e3f/watchdog-2.1.2.tar.gz
Collecting aiohttp==3.7.4 (from habapp)
  Using cached https://www.piwheels.org/simple/aiohttp/aiohttp-3.7.4-cp37-cp37m-linux_armv7l.whl
Collecting pendulum==2.1.2 (from habapp)
  Using cached https://files.pythonhosted.org/packages/db/15/6e89ae7cde7907118769ed3d2481566d05b5fd362724025198bb95faf599/pendulum-2.1.2.tar.gz
  Installing build dependencies ... done
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.7/tokenize.py", line 447, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-lscf1s_f/pendulum/setup.py'

Hm - can you try installing pendulum==2.1.1.
Maybe the older version will work as a workaround.

Hi there, same problem over here. I’ve run sudo python3 -m pip install pendulum==2.1.1 which completed successfully, but sudo python3 -m pip install habapp is still failing.

Any suggestions?

First, ensure that pip is on the latest version

sudo python3 -m pip install pip --upgrade

Could you then try

sudo python3 -m pip install pendulum==2.1.1

and then

sudo python3 -m pip install pendulum --upgrade

thanks, it seems this problem is fixed. At least running
sudo python3 -m pip install habapp
now states Successfully installed habapp-0.31.1.

However, habapp still does not start.
sudo systemctl status habapp returns

   Active: failed (Result: exit-code) since Mon 2021-11-01 08:51:43 CET; 2s ago
     Docs: https://habapp.readthedocs.io
  Process: 2302 ExecStart=/opt/habapp/bin/habapp -c /etc/openhab/habapp (code=exited, status=1/FAILURE)
 Main PID: 2302 (code=exited, status=1/FAILURE)

Nov 01 08:51:43 oh2021 habapp[2302]: Traceback (most recent call last):
Nov 01 08:51:43 oh2021 habapp[2302]:   File "/opt/habapp/bin/habapp", line 5, in <module>
Nov 01 08:51:43 oh2021 habapp[2302]:     from HABApp.__main__ import main
Nov 01 08:51:43 oh2021 habapp[2302]:   File "/opt/habapp/lib/python3.7/site-packages/HABApp/__init__.py", line 5, in <module>
Nov 01 08:51:43 oh2021 habapp[2302]:     import HABApp.__do_setup__
Nov 01 08:51:43 oh2021 habapp[2302]:   File "/opt/habapp/lib/python3.7/site-packages/HABApp/__do_setup__.py", line 4, in <module>
Nov 01 08:51:43 oh2021 habapp[2302]:     import pydantic  # noqa: E402
Nov 01 08:51:43 oh2021 habapp[2302]: ModuleNotFoundError: No module named 'pydantic'
Nov 01 08:51:43 oh2021 systemd[1]: habapp.service: Main process exited, code=exited, status=1/FAILURE
Nov 01 08:51:43 oh2021 systemd[1]: habapp.service: Failed with result 'exit-code'.

Hm - it seems that pip thinks all HABApp dependencies are successfully installed when they are not.
Could you try install required packages by hand? Then it should start properly.

I was able to do this following the error messages when executing from the command line, with the exception that when it complains about ‘paho’ you need to install ‘paho-mqtt’. I did not specify version numbers and will test shortly, and use your list if it is not running properly.

manually reinstalling dependencies did not help.

However, I figured out that running
habapp --config PATH_TO_CONFIGURATION_FOLDER
worked, so I checked for differences … and the command above resolved to /usr/local/bin/habapp instead of /opt/habapp/bin/habapp which was called in by habapp.service.

So after changing habapp.service to use /usr/local/bin/habapp I can finally explore habapp. Thanks!

Hi,

I have the same issue with “pedantic” error. I have installed habapp using openhabian-config option. I am running latest openhabian 3.1. I installed all dependencies by hand, but it didn’t help.

penhabian@openhabian:~ $ ./habapp -c /etc/openhab/habapp/
-bash: ./habapp: No such file or directory
openhabian@openhabian:~ $ /opt/habapp/bin/habapp -c /etc/openhab/habapp/
Traceback (most recent call last):
  File "/opt/habapp/bin/habapp", line 5, in <module>
    from HABApp.__main__ import main
  File "/opt/habapp/lib/python3.7/site-packages/HABApp/__init__.py", line 5, in <module>
    import HABApp.__do_setup__
  File "/opt/habapp/lib/python3.7/site-packages/HABApp/__do_setup__.py", line 4, in <module>
    import pydantic  # noqa: E402
ModuleNotFoundError: No module named 'pydantic'

Any help will be great.
Thanks!

Can you install pendulum by hand?

Then you can install the required packages manually:

Thanks, that worked. I needed to to that after activate. After that I had issue with OpenHAB login, but I found that I need to enable basic auth. Another issue was, that fronttail settings were not installed - I did it by hand and now I can see some logs.
Latest issue I have is with example rule. I can see in log that rule has been loaded, but I can’t see anything in log. If I understand correctly, there should be "that was easy!’ message somewhere.

2021-11-22 08:35:13.615 [INFO ] [HABApp.Rules                        ] - Added rule "MyFirstRule" from rules/MyFirstRule.py

I tried using logger as well, but also no luck.
My modified example looks like this:

import logging
import HABApp

log = logging.getLogger('MyRule')

# Rules are classes that inherit from HABApp.Rule
class MyFirstRule(HABApp.Rule):
    def __init__(self):
        super().__init__()

        # Use run.at to schedule things directly after instantiation,
        # don't do blocking things in __init__
        self.run.soon(self.say_something)

    def say_something(self):
        log.info('That was easy!')

# Rules
MyFirstRule()
log.info('Info Message')

Many thanks!
Marcin

You have to log to an existing logger and a logger ‘MyRule’ that does write to a file does not exist.
Use the logging.yml to add loggers and define their output files.

Ach, so obvious! :smiley: Thank you! Now all works. Just last question, what happens with print output?
In MyFirstRule example there is print. I assume that it should work too right? Is STD output handled somehow?

Cheers,
Marcin

If you start habapp by hand (e.g. from the console) the print will show in the console window.
If you start habapp as a service you can see the print in the status of the service or the journal.

Thanks!

Hi @Spaceman_Spiff
I have the same issue and none of the given answers seem to work.
I set up a new openhabian for testing on rPi 3B.
First I tried installing habapp from openhabian-config which seemed to work, the venv was created but starting resulted in ModuleNotFoundError: No module named ‘pydantic’
After that I installed habapp and all packages from the list manually (They all were missing), but still the same error when trying to run habapp.

BTW: What is the minimum Python version for habapp? My productive system runs on raspbian stretch (manual setup) that does not support python > 3.5. Do I need to set up a new system to use habapp?

Regards,
Martin

HABApp and its dependencies need at least python 3.7 to work properly.

You can always manually install a more recent python distribution.

Python 3.5 is the latest version in the repositories for raspbian stretch, so I tried compiling 3.7 but it always ended in errors, so I will probably set up a new productive system.

However this is not the reason for my problems, the test system has a recent python installed.

Today I tried again and it worked (after installing the dependencies manually).
Maybe my fault was to perform these steps inside the virtual environment, not outside:

Sorry to res an old post, but I’m having this same problem trying to install HABApp, except it’s with a package called “EasyCo”. I was able to manually install Pydantic, and got past that dependency (haven’t gotten to pendulum yet), but I’m stuck on trying to get it to recognize the install for EasyCo.

I’ve done both

sudo pip install EasyCo

and also

sudo pip3 install EasyCo

Both seem to work after updating pip (it says “requirement already satisfied”). But when I go back to running the HABApp installer

habapp --config /etc/openhab/habapp

I still get “ModuleNotFoundError: No module named ‘EasyCo’”.

If I try installing EasyCo with pip2, I get a syntax error. But I’m assuming that I shouldn’t want a python2 version of EasyCo. I should want the python3 version, right? How do I get past this?