You are not logged in.

#1 2025-03-14 11:31:22

InFerYes
Member
Registered: 2012-11-13
Posts: 38

home-assistant No module named 'pymysql' or No module named 'MySQLdb'

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

Board footer

Powered by FluxBB