Managing pymodbus versions in custom integrations

Hello Home Assistant developers,

I am currently developing a custom integration that relies on pymodbus version 3.6.9. However, I noticed that the official modbus integration in Home Assistant uses pymodbus version 3.8.3. Since Home Assistant uses a shared Python environment, I’m concerned about potential conflicts between these versions.

I am aware of the ability to declare a dependency on another integration using the dependencies field in manifest.json . However, my understanding is that this approach ensures the other integration is loaded but doesn’t handle version isolation.

I would prefer to retain control over the version I depend on, if it can be done in a straightforward manner.

Is there a recommended way to ensure compatibility or version isolation in such cases? Should I adapt my integration to the version already used by Home Assistant (pymodbus 3.8.3) or is there a way to handle versioning more flexibly for custom integrations?

Thank you for your insights!

1 Like

I am a user of another integration who heavily depends on pyModbus. I have issued this multiple times a year because of these incompatibilities. This time, I even need to skip Home-Assistant version. I have no idea if it is possible, but it will be beneficial to isolate pyModbus per integration.

Users that use the native modbus-integration alongside this integration should not upgrade to Home Assistant 2025.1, as it contains an upgrade to an incompatible version 3.7.4 of the pyModbus library. Significant work has already been done to upgrade this integration to support v3.8.0 of this library. We expect this to release alongside Home Assistant 2025.2, which is expected to also upgrade to that latest pyModbus version. This will solve the compatibility issue.