Missing httpx module?
Hi,
after upgrading the bot wasn't starting for me anymore.
I manually tried to start it and got
└─■ # /usr/sbin/runuser -l main -c 'cd /omd/sites/main/local/share/checkmk-telegram-plus && /omd/sites/main/bin/python3 /omd/sites/main/local/share/checkmk-telegram-plus/telegram_bot.py'
Traceback (most recent call last):
File "/omd/sites/main/local/share/checkmk-telegram-plus/telegram_bot.py", line 15, in <module>
from telegram import (
File "/opt/omd/sites/main/local/share/checkmk-telegram-plus/telegram/__init__.py", line 285, in <module>
from . import _version, constants, error, helpers, request, warnings
File "/opt/omd/sites/main/local/share/checkmk-telegram-plus/telegram/request/__init__.py", line 21, in <module>
from ._httpxrequest import HTTPXRequest
File "/opt/omd/sites/main/local/share/checkmk-telegram-plus/telegram/request/_httpxrequest.py", line 23, in <module>
import httpx
ModuleNotFoundError: No module named 'httpx'
I manually fixed it with
└─■ # pip3 install --target=/omd/sites/main/local/share/checkmk-telegram-plus httpx --upgrade
Collecting httpx
Using cached httpx-0.28.1-py3-none-any.whl (73 kB)
Collecting anyio
Using cached anyio-4.8.0-py3-none-any.whl (96 kB)
Collecting certifi
Using cached certifi-2024.12.14-py3-none-any.whl (164 kB)
Collecting httpcore==1.*
Using cached httpcore-1.0.7-py3-none-any.whl (78 kB)
Collecting idna
Using cached idna-3.10-py3-none-any.whl (70 kB)
Collecting h11<0.15,>=0.13
Using cached h11-0.14.0-py3-none-any.whl (58 kB)
Collecting sniffio>=1.1
Using cached sniffio-1.3.1-py3-none-any.whl (10 kB)
Collecting typing_extensions>=4.5
Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Installing collected packages: typing_extensions, sniffio, idna, h11, certifi, httpcore, anyio, httpx
Successfully installed anyio-4.8.0 certifi-2024.12.14 h11-0.14.0 httpcore-1.0.7 httpx-0.28.1 idna-3.10 sniffio-1.3.1 typing_extensions-4.12.2
I guess the httpx module is just missing in the ressources/requirements.txt.
Since i don't know if it needs a specific version i just created the issue instead of an pull request. For me it is working fine now
br Mike
I think it depends on the exact checkmk version, in 90% of my test environments I had to remove httpx so that the bot accesses the httpx version of Checkmk/the host, but I couldn't find out exactly for which CheckMK versions this is the case... As of now, httpx is not installed / removed during installation as it was more successful in my tests.
If an exact version can be located when the httpx lib needs to be installed, I will update it accordingly. Until then I will leave this issue open so that other people like you may have a solution for that.
After upgrading CheckMk to its latest version and rebooting I noticed the Telegram Plus Agent was asking for an update as well :-)
But after the upgrade - TPA was unable to start and complained also about the missing httpx module. I did all the debuging stuff with no success and ended up removing and reinstalling it. Not even then TPA was unable to start.
What helped me was the following commands:
systemctl stop checkmk-telegram-plus-<omd_site_name> su - <omd_site_name> cd ~/local/share/checkmk-telegram-plus source ~/bin/activate pip install --target ~/local/lib/python3 httpx
I hope my information helps others who are facing the same problem.