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

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.

For anyone having problems with this, the solution appears to be pretty easy. This is what I did:

sudo su -s /bin/bash homeassistant
vi /srv/homeassistant/pyvenv.cfg

the edit the line from:

include-system-site-packages = false

to:

include-system-site-packages = true

restart or reboot and it started working for me. Hope that helps

3 Likes

I am not able to edit pyvenv.cfg file I can see the content but nothing happens when deleting content.

Any suggestions on how to edit the file.

Try using nano instead of vi: nano /srv/homeassistant/pyvenv.cfg

I know that this is an older thread, but just wanted to say thanks to @dinki for the suggestion to change include-system-site-packages to “true”, worked like a charm and now zwave component is showing as ‘ready’!

While im happy that its now working, I have no idea why it worked or what it did. could someone please explain? I want to make sure im learning and not just blindly copying lines of code! - thanks