Custom modbus sensors stopped working

Hi,
After HA reset yesterday my custom modbus integration stopped working.
When checking the YML configuration it shows error: Integration error: modbus - Requirements for modbus not found: [‘pymodbus==3.1.3’].

This worked without a problem for past few months, what might’ve changed?

What does this mean?

How did you install HA?

Did you maybe change anything you’re not telling us about?

Hey Peter,
The HA OS V9.5 is installed on a Virtual machine on a server - which I had to restart yesterday. The server came back online along with HA, but from this point the custom modbus integration stopped working.
I have not changed anything in the HA itself before the error occured.
Looking at logs I can see some more errors regarding to modbus:

Unable to install package pymodbus==3.1.3: WARNING: Ignoring invalid distribution -ymodbus (/usr/local/lib/python3.10/site-packages) WARNING: Ignoring invalid distribution -ymodbus (/usr/local/lib/python3.10/site-packages) ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/usr/local/lib/python3.10/site-packages/pymodbus-3.1.3.dist-info/METADATA' WARNING: Ignoring invalid distribution -ymodbus (/usr/local/lib/python3.10/site-packages) WARNING: Ignoring invalid distribution -ymodbus (/usr/local/lib/python3.10/site-packages) WARNING: Ignoring invalid distribution -ymodbus (/usr/local/lib/python3.10/site-packages) [notice] A new release of pip is available: 23.0 -> 23.0.1 [notice] To update, run: pip install --upgrade pip

Looking online I can see that this might be cause by python itself incorrectly adding ~ prefix to the modbus library.
Editing:
Logged in to the VM shell and then to the homeassistant docker container using

docker exec -it homeassistant /bin/bash

Located the site-packages directory where indeed ymodbus packages had ~ prexif. Removed the packages and restarted HA.

Now the error is:

Unable to install package pymodbus==3.1.3: ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/usr/local/lib/python3.10/site-packages/pymodbus-3.1.3.dist-info/METADATA' [notice] A new release of pip is available: 23.0 -> 23.0.1 [notice] To update, run: pip install --upgrade pip

Checked the contents of this directory and sure enough, inside there’s only some .tmp file.

Last edit:
removed the pymodbus3.1.1 library folder, run the “ha supervisor repair” command, restarted VM and modbus is working.
Not sure what happened that broke it