You are not logged in.
I have installed home-assistant on my server via pacman (pacman -Syu home-assistant). Recently home-assistant has been unable to use it's recorder function because it can't connect to the database.
The database is a MariaDB instance on a remote server. I have verified that the connection string works and that it is correct.
Home-assistant gives me the error "No module named 'pymysql'"
I have installed pymysql via pacman (pacman -Syu python-pymysql) and verified that python picks it up by using python -c "import pymysql" and checking the exit code (0).
The wiki has an entry that says to remove the /var/lib/hass/deps/lib folder if there are any problems with ModuleNotFoundErrors in logs, but when I run the command from the wiki I get
rm: cannot remove '/var/lib/hass/deps/lib': No such file or directory
and indeed, there is no lib folder in /var/lib/hass/deps (where /var/lib/hass is actually a symlink: /var/lib/hass -> private/hass).
I have the same issue when I change the connection string from mysql+pymysql:// to simply mysql://, but then I get "No module named 'MySQLdb'". I have also installed the package python-mysqlclient because of this but to no avail.
Where is the lib folder located lately?
Does anyone else have a remote database server that they connect to and how is it set up in the home-assistant configuration?
I hope someone can shed some light on this.
Thank you!
Offline
Also had problems with this and found your post.
I tried a few things out, and I think I found a solution.
You could execute something like:
/var/lib/hass/.venv/bin/python -m pip install mysqlclient
(MySQL db is included in mysqlclient).
Executing Python from the venv directory itself seems to include it properly.
To be sure it is installed in future startups, I included the line in /usr/lib/systemd/system/home-assistant.service. And triggered a daemon-reload before restarting the home-assistant service .
Hope this helps
Offline