HA complaining python-openzwave is not installed even though it is

Hi,

I just tried a manual install of HA on RPi and once I got to the Z-Wave part I ran into trouble. I have python-openzwave installed and the config directory is /usr/local/lib/python3.4/dist-packages/libopenzwave-0.3.1-py3.4-linux-armv7l.egg/config but HA gives me the following error upon startup:

16-10-21 22:04:23 INFO (Thread-1) [homeassistant.util.package] Attempting install of pydispatcher==2.0.5
16-10-21 22:04:28 ERROR (Thread-1) [homeassistant.components.zwave] You are missing required dependency Python Open Z-Wave. Please follow instructions at: https://home-assistant.io/components/zwave/
16-10-21 22:04:28 ERROR (Thread-1) [homeassistant.bootstrap] component zwave failed to initialize

I also made sure to add user homeassistant to group dialout. My Z-Wave USB stick is definetly working as Iā€™ve used it with multiple other home automation apps on this system.

I have the following packages installed and working:

ii  libopenzwave-doc                 1.5+ds-1                   all          documentation for the openzwave library
ii  libopenzwave1.5                  1.5+ds-1                   armhf        API to use a Z-Wave controller
ii  libopenzwave1.5-dev              1.5+ds-1                   armhf        header files for the openzwave library
ii  openzwave                        1.5+ds-1                   armhf        Sample Program for libopenzwave
ii  python-openzwave                 0.3.0-1                    armhf        python-openzwave is a python wrapper for the openzwave c++ library.

And my Z-Wave HA config is as follows:

zwave:
  usb_path: /dev/zwave
  config_path: /usr/local/lib/python3.4/dist-packages/libopenzwave-0.3.1-py3.4-linux-armv7l.egg/config

Does anyone have any ideas as to what might be wrong here?

Thanks in advance.

Regards,
Michal

Are you sure this path exists? I would not expect a packaged version of python-openzwave to install to /usr/local/lib, and 0.3.1 != 0.3.0

Hi,

Thanks for responding. I followed the instructions on the HA ZW page which are as followed:

$ git clone https://github.com/OpenZWave/python-openzwave.git
$ cd python-openzwave
$ git checkout python3
$ PYTHON_EXEC=$(which python3) make build
$ sudo PYTHON_EXEC=$(which python3) make install
Instead of make install, you can alternatively build your own python-openzwave package which can be easily uninstalled: $ sudo PYTHON_EXEC=$(which python3) checkinstall --pkgname python-openzwave --pkgversion 1.0 --provides python-openzwave

With this installation, your config_path needed below will resemble:

/usr/local/lib/python3.4/dist-packages/libopenzwave-0.3.0b8-py3.4-linux-x86_64.egg/config

Not sure how it chose the version numbering but the files and the package are definitely linked:

pi@homepi:~ $ dpkg -S /usr/local/lib/python3.4/dist-packages/libopenzwave-0.3.1-py3.4-linux-armv7l.egg/config
python-openzwave: /usr/local/lib/python3.4/dist-packages/libopenzwave-0.3.1-py3.4-linux-armv7l.egg/config

Any ideas as to what I could try next?

Regards,
Michal

While this may not be directly helpful, I would like to share a blog post I wrote up not long ago for installing hass & open-zwave. Maybe it can be of assistance:

https://deviantengineer.com/2016/09/hass-dietpi/

I actually found this page earlier when trying to figure out how to compile the openzwave control panel :slight_smile:

Unfortunately it doesnā€™t seem to be related to my problem, which is Home Assistant stubbornly not seeing python-openzwave even though itā€™s installed clear as day.

EDIT: Actually the problem seems to be that Debian python3 is not looking in /usr/local/lib/python3.4/dist-packages/ (at least for libopenzwave). I donā€™t understand enough about how all this works to fix it at this stageā€¦ I see Linux is still as much trouble as when I first got into it when Debian 3.0 was still unstable :confused:

I long for the distant future thousands of years ahead when computers just work without all this troubleā€¦ But Iā€™m afraid it will take AI to solve and we will be made redundant.

EDIT2: And WTF is this a step when Iā€™m using OpenZwave 1.5?!

make[2]: Entering directory '/home/pi/python-openzwave/openzwave/cpp/build'
Building OpenZWave Version 1.4-2206-gbe834e3-dirty

What do you see if you run pip3 list | grep openzwave? Here is what I have.

root@hass:~# pip3 list | grep openzwave
libopenzwave (0.3.1)
openzwave (0.3.1)
```

I've run into a couple issues where hass tries to install packages via pip but it doesn't actually happen, so after upgrades to newer versions of hass I keep an eye on the log to make sure packages install.  
So if you don't have those two packages listed above installed, install them (i.e., `pip3 install openzwave==0.3.1`, etc).  Check for pydispatcher (`pip3 list | grep pydispatcher`), if not installed go ahead and install it.  Restart hass, and assess.

PyOZW pulls down its own copy of OZW and builds against it. You may need to cd python-openzwave; git submodule update then rebuild. But that probably wonā€™t help with finding it after.

Hereā€™s the crux of it:

pi@homepi:~ $ python3
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import openzwave
pi@homepi:~ $ sudo su -s /bin/bash homeassistant
homeassistant@homepi:/home/pi $ cd /srv/homeassistant
homeassistant@homepi:/srv/homeassistant $ python3 -m venv homeassistant_venv
homeassistant@homepi:/srv/homeassistant $ source /srv/homeassistant/homeassistant_venv/bin/activate
(homeassistant_venv) homeassistant@homepi:/srv/homeassistant $ python3
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import openzwave
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'openzwave'

The problem is the virtual environment in which HA runsā€¦ I donā€™t know what I would have to do to solve this.

I Raspbian proper:

pi@homepi:~/python-openzwave $ pip3 list | grep openzwave
libopenzwave (0.3.1)
openzwave (0.3.1)

In the HA virtual environment:

(homeassistant_venv) homeassistant@homepi:/srv/homeassistant $ pip3 list | grep openzwave
(homeassistant_venv) homeassistant@homepi:/srv/homeassistant $

So the problem is that inside the HA environment it cannot see the system wide installation.

Anyone? Any ideas?

I canā€™t make sense of this.

EDIT: I havenā€™t checked whether this is the problem yet, but Iā€™ll take an educated guess that it probably is. If so then the instructions on the HA site for manual installation are very deceiving.

homeassistant@homepi:~ $ cat /srv/homeassistant/homeassistant_venv/pyvenv.cfg
home = /usr/bin
include-system-site-packages = false
version = 3.4.2

BAM!

(homeassistant_venv) homeassistant@homepi:~ $ pip3 list | grep openzwave
libopenzwave (0.3.1)
openzwave (0.3.1)

So it should be made clear in the manual installation instructions that if you need any python packages they need to be created WITHIN the virtual environment or this setting needs to be changed.

1 Like

You Sir are a miracle worker!!! I have been fighting with this for about 4 hours! THANK YOU!

Right. Think of the virtual environment as itā€™s own Pi.

Unfortunately the instructions on the HA website donā€™t take that into consideration.

That one small change in the confit file should be noted, or it should be explicitly stated and shown in the correct order that you compile and install the python packages inside the virtual environment.

Either way would prevent a lot of frustration for new adopters.

Youā€™re welcome :slight_smile:

I am now encountering a slight different problem, even after fixing the first issue of a missing python module.

Has anyone seen this in their error log recently?

16-10-26 10:38:14 homeassistant.bootstrap: Error during setup of component zwave
Traceback (most recent call last):
File ā€œ/usr/local/lib/python3.5/site-packages/openzwave-0.3.1-py3.5.egg/openzwave/network.pyā€, line 322, in init
self.dbcon = lite.connect(os.path.join(self._options.user_path, ā€˜pyozw.sqliteā€™), check_same_thread=False)
NameError: name ā€˜liteā€™ is not defined

I am having extreme difficulty solving this one. It started showing up when I upgraded Cython and recompiled OpenZWave the other day.

Sorry, but what exactly did you do to get this working? I still cannot get z-wave to work under this version of HA after using and installing hassbian.
Any help getting z-wave to work under hassbian will be highly apreciated.

Did you figure it out? If you did please let me knowā€¦ I installed HASS using HASSBIAN and I cannot get z-wave to work at all. I can see the differences that you pointed out, but I do not know what to do to make it work.
Thanks!

1 Like

I am using hassbian image for raspberry PI and am getting these errors in my logs:

16-12-17 12:07:51 homeassistant.components.zwave: You are missing required dependency Python Open Z-Wave. Please follow instructions at: https://home-assistant.io/components/zwave/
16-12-17 12:07:51 homeassistant.bootstrap: component zwave failed to initialize

Any Help would be appreciated.
I followd the instructions at: https://home-assistant.io/getting-started/z-wave/

If I do a pip3 list | grep openzwave I get

  libopenzwave (0.3.1)
  openzwave (0.3.1) 

This location also exists:

/usr/local/lib/python3.4/dist-packages/libopenzwave-0.3.1-py3.4-linux-armv7l.egg/config/

I dont have /srv/hass/python-openzwave/openzwave/config I do have /srv/homeassistant

Any help please would be great @mihalski

Please follow this link to get it to work:

I had to follow the all in one installer to get it to work.

I canā€™t remember if Hassbian sets things up in a venv like the all-in-one installer does. But if thatā€™s the case, you kinda need to treat that virtual environment like itā€™s own pi and install inside the venv. Otherwise packages wonā€™t be available.

Search the forum for the commands to sudo to the correct (hass?) user and enter the venv.