Open psfales opened 2 months ago
Hey there @bieniu, mind taking a look at this issue as it has been labeled with an integration (brother
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
brother documentation brother source (message by IssueLinks)
I'm not able to reproduce this.
Do you use any custom integration using the SNMP?
Could you check the version of the pysnmp package? (pip show pysnmp
when HA venv
is active)
(homeassistant3.12) $ pip show pysnmp
Name: pysnmp
Version: 6.2.5
Summary: A Python library for SNMP
Home-page: https://github.com/lextudio/pysnmp
Author: Ilya Etingof
Author-email: etingof@gmail.com
License: BSD-2-Clause
Location: /srv/homeassistant3.12/lib/python3.12/site-packages
Requires: pyasn1, pysmi, pysnmpcrypto
Required-by: brother
I experimented with different versions of pysnmp, both earlier and later than 6.2.5, but it didn't seem to make any difference. What version should I be using?
I am getting the same error. I just upgraded from 2024.6. I have the same pysnmp version.
Ah, I got it working by going all the way back to pysnmp 6.1.3. I don't know when/how the newer version got installed or if it's going to cause other problems with HA, but it seems to be working OK right now!
For the record, my workaround for now:
pip install --upgrade pysnmp==6.1.3
As I say, I don't know what the downsides might be with doing that, but everything seeems to be OK for now.
What version should I be using?
6.2.5 is the correct version but I checked and there is not even a pysnmp/hlapi/asyncio/sync/init.py
file in version 6.2.5 so your package looks strange.
Please reinstall the package:
pip uninstall pysnmp pyasn1 pysmi pysnmpcrypto pysnmp-lextudio pysmi-lextudio
pip install pysnmp==6.2.5
That worked for me. I guess some old junk was left hanging around.
Worked for me too. Not sure how it got into that state, but thanks for the help!
HA 2024.9 migrates pysnm-lextudio
package to original pysnmp
(pysnmp
has not been developed for some time because its creator died). As you can see for core installation migration did not proceed correctly.
Thanks for the insight. As a side note, I was confused about when the problem occurred because reverting to 2024.8.3 did not fix it. I didn't think I had seen it prior to 2024.9.0, but I was starting to wonder. It looks like whatever the migration did in 9.0 to break things persisted after reverting back to 8.3!
Hi, I have same problem. I run home assistant core on an LXC container in Proxmox. If I try this code:
pip uninstall pysnmp pyasn1 pysmi pysnmpcrypto pysnmp-lextudio pysmi-lextudio
pip install pysnmp==6.2.5
from LXC console I obtain: -bash: pip: command not found
Please help me!
What version should I be using?
6.2.5 is the correct version but I checked and there is not even a
pysnmp/hlapi/asyncio/sync/init.py
file in version 6.2.5 so your package looks strange.Please reinstall the package:
pip uninstall pysnmp pyasn1 pysmi pysnmpcrypto pysnmp-lextudio pysmi-lextudio pip install pysnmp==6.2.5
After doing this I get the error:
Logger: homeassistant.config_entries
Source: config_entries.py:2894
First occurred: 15:26:48 (1 occurrences)
Last logged: 15:26:48
Error occurred loading flow for integration brother: No module named 'pyasn1.compat.octets'
Okay looks like we need pysnmp 6.2.6
that fixes a recent change in pyasn1. How do we force this version? Each time HA starts it downgrades it.
After doing this I get the error:
You need:
pip install --upgrade pyasn1==0.6.0
Look here https://github.com/home-assistant/core/pull/125712
Hi, I have same problem. I run home assistant core on an LXC container in Proxmox. If I try this code:
pip uninstall pysnmp pyasn1 pysmi pysnmpcrypto pysnmp-lextudio pysmi-lextudio pip install pysnmp==6.2.5
from LXC console I obtain:
-bash: pip: command not found
Please help me!
Anyone can help me please.
Anyone can help me please.
I guess you have to activate the python virtual environment first source <VENV_FOLDER>/bin/activate
. You just need to know where the venv
folder is in the container.
Ok, but is this the only way to restore function of brother plugin or in next home assistant update all goes well?
Upgrading to 2024.10.0 started showing this for me too...
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
component = await integration.async_get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component
self._component_future.result()
File "/usr/src/homeassistant/homeassistant/loader.py", line 1007, in async_get_component
comp = await self.hass.async_add_import_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/usr/src/homeassistant/homeassistant/components/brother/__init__.py", line 5, in <module>
from brother import Brother, SnmpError
File "/usr/local/lib/python3.12/site-packages/brother/__init__.py", line 13, in <module>
from pysnmp.hlapi.asyncio import (
File "/usr/local/lib/python3.12/site-packages/pysnmp/hlapi/__init__.py", line 7, in <module>
from pysnmp.proto.rfc1902 import *
File "/usr/local/lib/python3.12/site-packages/pysnmp/proto/rfc1902.py", line 8, in <module>
from pysnmp.proto import rfc1155, error
File "/usr/local/lib/python3.12/site-packages/pysnmp/proto/rfc1155.py", line 10, in <module>
from pysnmp.proto import error
File "/usr/local/lib/python3.12/site-packages/pysnmp/proto/error.py", line 9, in <module>
from pysnmp import debug
File "/usr/local/lib/python3.12/site-packages/pysnmp/debug.py", line 8, in <module>
from pyasn1.compat.octets import octs2ints
ModuleNotFoundError: No module named 'pyasn1.compat.octets'
Upgrading to 2024.10.0 started showing this for me too...
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component component = await integration.async_get_component() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component self._component_future.result() File "/usr/src/homeassistant/homeassistant/loader.py", line 1007, in async_get_component comp = await self.hass.async_add_import_executor_job( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 995, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/usr/src/homeassistant/homeassistant/components/brother/__init__.py", line 5, in <module> from brother import Brother, SnmpError File "/usr/local/lib/python3.12/site-packages/brother/__init__.py", line 13, in <module> from pysnmp.hlapi.asyncio import ( File "/usr/local/lib/python3.12/site-packages/pysnmp/hlapi/__init__.py", line 7, in <module> from pysnmp.proto.rfc1902 import * File "/usr/local/lib/python3.12/site-packages/pysnmp/proto/rfc1902.py", line 8, in <module> from pysnmp.proto import rfc1155, error File "/usr/local/lib/python3.12/site-packages/pysnmp/proto/rfc1155.py", line 10, in <module> from pysnmp.proto import error File "/usr/local/lib/python3.12/site-packages/pysnmp/proto/error.py", line 9, in <module> from pysnmp import debug File "/usr/local/lib/python3.12/site-packages/pysnmp/debug.py", line 8, in <module> from pyasn1.compat.octets import octs2ints ModuleNotFoundError: No module named 'pyasn1.compat.octets'
doing this:
pip uninstall pysnmp pyasn1 pysmi pysnmpcrypto pysnmp-lextudio pysmi-lextudio
pip install pysnmp
worked for me.
Yeah, but users shouldn't be needing to run commands manually ;)
It looks like https://github.com/home-assistant/core/pull/126488 is supposed to be in 2024.10.0, but hasn't fixed it?
I have tried to reproduce the problem on HA OS and HA Core multiple times and have failed, so I suspect some custom integration or sharing of venv with another python app/script is to blame. For some reason the pysnmp package is not being updated properly or is being overwritten.
Please check if any custom integration uses pysnmp
package (this information is in the manifast.json
file in the integration folder). If so, disable this integration and restart HA.
doing this:
pip uninstall pysnmp pyasn1 pysmi pysnmpcrypto pysnmp-lextudio pysmi-lextudio pip install pysnmp
worked for me.
Can you just run this straight from the HA CLI (e.g. via the SSH & Web Terminal Add-On) or do you need to hop into a python venv first? I'm running HA OS. I ran it from the CLI which is already in the HA container. No dice. Is there a python venv I need to drop into?
126488 was not intended to fix this problem. I have tried to reproduce the problem on HA OS and HA Core multiple times and have failed, so I suspect some custom integration or sharing of venv with another python app/script is to blame. For some reason the pysnmp package is not being updated properly or is being overwritten.
Please check if any custom integration uses
pysnmp
package (this information is in themanifast.json
file in the integration folder). If so, disable this integration and restart HA.
In my case, i did have an old integration that was using pysnmp-lextudio
. I proceeded to update that integration to pysnmp
since it was custom, but that wasn't enough, i still needed to run the commands manually to purge the old packages before things would work properly.
Please check if any custom integration uses
pysnmp
package (this information is in themanifast.json
file in the integration folder). If so, disable this integration and restart HA.
I've just checked and only integration which using pysnmp according to manifest.json is brother integration - nothing else. And problem still exists :(
The release for https://github.com/jaroschek/home-assistant-eaton-ups/issues/32 seems to have fixed both instances that were showing for me
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Fwiw I ended up disabling the integration (2024.9.1)
For me still not working - @bieniu maybe it's caused as I was testing Your version few months ago that You've provided on FB forum?
version few months ago that You've provided on FB forum?
If you are still using this old custom version, you should remove it.
Please add this to your configuration.yaml
file:
logger:
default: error
logs:
homeassistant.util.package: debug
restart HA, wait a few minutes and attach here a log file.
Hi @bieniu - one log is with HACS folder from You, second one after removal of this folder. home-assistant_2024-10-27T23-15-37.497Z.log home-assistant_2024-10-27T23-09-49.436Z.log
@przemoc86 The log for old custom version is not needed here.
Let's try something different... could you add this to your configuration.yaml
file, restart HA and attach here the log file.
sensor:
- platform: snmp
host: <BROTHER_PRINTER_IP_ADDRESS>
baseoid: 1.3.6.1.2.1.1.3.0
@bieniu I was just going to remove this HACS so that's why I've just added both :)
What type of HA installation are you using?
Try to extract this to /config/custom_components
, restart HA, add SNMP sensor and once again restart HA.
snmp_test.zip
HAOS - latest version - on proxmox VM home-assistant_2024-10-28T11-54-57.694Z.log
hello @bieniu - any updates maybe? :(
The problem
After upgrading from 2024.8.3 to 2024.9.0, the Brother Printer integration is failing.
Here is the complete traceback:
Traceback (most recent call last): File "/srv/homeassistant3.12/lib/python3.12/site-packages/homeassistant/setup.py", line 334, in _async_setup_component component = await integration.async_get_component() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/homeassistant3.12/lib/python3.12/site-packages/homeassistant/loader.py", line 1027, in async_get_component self._component_future.result() File "/srv/homeassistant3.12/lib/python3.12/site-packages/homeassistant/loader.py", line 1007, in async_get_component comp = await self.hass.async_add_import_executor_job( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/python3.12/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, *self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/homeassistant3.12/lib/python3.12/site-packages/homeassistant/loader.py", line 1067, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/homeassistant3.12/lib/python3.12/site-packages/homeassistant/util/loop.py", line 200, in protected_loop_func return func(args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/python3.12/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/srv/homeassistant3.12/lib/python3.12/site-packages/homeassistant/components/brother/init.py", line 5, in
from brother import Brother, SnmpError
File "/srv/homeassistant3.12/lib/python3.12/site-packages/brother/init.py", line 13, in
from pysnmp.hlapi.asyncio import (
File "/srv/homeassistant3.12/lib/python3.12/site-packages/pysnmp/hlapi/init.py", line 15, in
from pysnmp.hlapi.asyncio.sync import
File "/srv/homeassistant3.12/lib/python3.12/site-packages/pysnmp/hlapi/asyncio/sync/init.py", line 9, in
from pysnmp.hlapi.asyncio.sync.cmdgen import
File "/srv/homeassistant3.12/lib/python3.12/site-packages/pysnmp/hlapi/asyncio/sync/cmdgen.py", line 14, in
from pysnmp.hlapi.varbinds import
ModuleNotFoundError: No module named 'pysnmp.hlapi.varbinds'
What version of Home Assistant Core has the issue?
core-2024.9.0
What was the last working version of Home Assistant Core?
core-2024.8.3
What type of installation are you running?
Home Assistant Core
Integration causing the issue
Brother Printer
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response