Python run inside HA venv crashes--ModuleNotFoundError: No module named 'homeassistant.remote'

I am running home assistant 88.2 in a venv under ubuntu 18.04. I’ve been getting errors on a python program that I’ve been launching successfully for some time with a shell command. To get additional data I decided to run the program manually from within the venv

Here’s what I did and the result.

(homeassistant) homeassistant@cassandra:~$ /srv/homeassistant/bin/python3 /home/homeassistant/.homeassistant/python_progs/check_webservers.py
Traceback (most recent call last):
File “/home/homeassistant/.homeassistant/python_progs/check_webservers.py”, line 3, in
import homeassistant.remote as remote
ModuleNotFoundError: No module named 'homeassistant.remote

I’ve looked through the docs and other posts about homeassistant.remote and haven’t found anything that seems helpful. Perhaps I missed sometning in the release notes. Hopefully it’s something obvious.

Here are the first several lines of the python program check_webservers.py

import csv
import time
import homeassistant.remote as remote
from homeassistant.const import STATE_ON, STATE_OFF
import urllib.requestPreformatted text

I do know 0.88.2 was released yesterday/ Perhaps one of the bug-fixes resolved your issue.

I updated to 0.88.2 same results

For what it’s worth I gave up on sending data directly to Home Assistant. Now I’m writing the data to my MQTT server running on the same machine as Home Assistant. So not exactly solved but a decent work around.

Anyone got a solution for this? I have the same issue with another py script.
Running 0.90.1

When in the virtual environment does pip3 list show homeassistant.remote installed? Is the script running in that virtual environment?

Hi
No I have only these when doing list in venv:
home-assistant-frontend 20190321.0
homeassistant 0.90.1
homeassistant-pyozw 0.1.2

I get this when running the .py

(homeassistant) hass@NUC:~/.homeassistant$ /home/hass/homeassistant/bin/python3 /home/hass/homeassistant/bin/z-wave-graph.py
Traceback (most recent call last):
  File "/home/hass/homeassistant/bin/z-wave-graph.py", line 32, in <module>
    import homeassistant.remote as remote
ModuleNotFoundError: No module named 'homeassistant.remote'
(homeassistant) hass@NUC:~/.homeassistant$

try pip3 install homeassistant.remote in the venv?
I am not at home to check my venv.

Hi
Can you please check which version you have?
I get

(homeassistant) hass@NUC:~/.homeassistant/shell$ pip3 install homeassistant.remote
Collecting homeassistant.remote
Could not find a version that satisfies the requirement homeassistant.remote (from versions: )
No matching distribution found for homeassistant.remote
(homeassistant) hass@NUC:~/.homeassistant/shell$

You are correct. There is no python module named homeassistant.remote.
Did you source your venv first? source /srv/homeassistant/bin/activate

I have no pythonprogs directory. I expect homeassistant.remote.py should be a file in the same directory as the script. You need to check with the people who supplied the script.

Hi
Yes the venv is active.
I´ll try to find the author.
Thanks

1 Like

have the same problem , would like to know if there is a way to include the missing modules, tks

Still have the same issue, anyone found a fix?

What’s common about these errors is that they look like they are coming from custom components. Are you running any custom component?

.homeassistant is the location of your config. python_progs must be some custom folder. That checkwebservers.py file is seemingly out of date.

This file producing the error is from the ‘graph your zwave network python file’.

@frelev I can’t say whats happening to you but it’s likely coming from old code. I’m only saying that because that’s what the other errors look like.