#14 Modbus (over TCP/IP) issue

Open
opened 1 year ago by John · 9 comments
John commented 1 year ago

Modbus over TCP/IP doesn't seem to work, in the log files I see this issue. Do you know how to resolve this?

Unable to install package pymodbus==1.5.2: ERROR: Will not install to the user site because it will lack sys.path precedence to pymodbus in /snap/home-assistant-snap/529/lib/python3.10/site-packages
Modbus over TCP/IP doesn't seem to work, in the log files I see this issue. Do you know how to resolve this? ``` Unable to install package pymodbus==1.5.2: ERROR: Will not install to the user site because it will lack sys.path precedence to pymodbus in /snap/home-assistant-snap/529/lib/python3.10/site-packages ```

Hi John,

This issue is hard to come around, as a package in the requirements.txt file of HA require a version that is different and was bundled with - and stored on the RO partition. So pip won't allow to install/update the package.

You can check the site-packages under the snap directory and search for it, just to confirm another version is there. E.g

sudo snap shell --run home-assistant-snap
find $SNAP -name pymodbus*

Then exit the shell when done.

I'm considering to not include the "requirement_all.txt" file, and let HA install whatever is necessary on demand and only lock down and ship with the bare minimum requirements for HA core - not the integrations.

Hi John, This issue is hard to come around, as a package in the requirements.txt file of HA require a version that is different and was bundled with - and stored on the RO partition. So pip won't allow to install/update the package. You can check the site-packages under the snap directory and search for it, just to confirm another version is there. E.g ``` sudo snap shell --run home-assistant-snap find $SNAP -name pymodbus* ``` Then `exit` the shell when done. I'm considering to not include the "requirement_all.txt" file, and let HA install whatever is necessary on demand and only lock down and ship with the bare minimum requirements for HA core - not the integrations.
John commented 1 year ago
Poster

Thanks Joachim,

I'm not sure if this is helpful, but here's the output:

digitalpals@ubuntu:~$ sudo snap run --shell home-assistant-snap
root@ubuntu:/snap/home-assistant-snap/529# find $SNAP -name pymodbus*
/snap/home-assistant-snap/529/bin/pymodbus.console
/snap/home-assistant-snap/529/bin/pymodbus.server
find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/caldav/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’.
find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/construct/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’.
find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/fritzconnection/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’.
find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/numpy/core/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’.
find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/numpy/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’.
find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/numpy/random/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’.
find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/pandas/_libs/src/ujson/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’.
/snap/home-assistant-snap/529/lib/python3.10/site-packages/pymodbus
/snap/home-assistant-snap/529/lib/python3.10/site-packages/pymodbus-2.5.3.dist-info
find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/pyric/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’.
root@ubuntu:/snap/home-assistant-snap/529# 
Thanks Joachim, I'm not sure if this is helpful, but here's the output: ``` digitalpals@ubuntu:~$ sudo snap run --shell home-assistant-snap root@ubuntu:/snap/home-assistant-snap/529# find $SNAP -name pymodbus* /snap/home-assistant-snap/529/bin/pymodbus.console /snap/home-assistant-snap/529/bin/pymodbus.server find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/caldav/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’. find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/construct/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’. find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/fritzconnection/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’. find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/numpy/core/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’. find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/numpy/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’. find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/numpy/random/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’. find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/pandas/_libs/src/ujson/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’. /snap/home-assistant-snap/529/lib/python3.10/site-packages/pymodbus /snap/home-assistant-snap/529/lib/python3.10/site-packages/pymodbus-2.5.3.dist-info find: File system loop detected; ‘/snap/home-assistant-snap/529/lib/python3.10/site-packages/pyric/lib’ is part of the same file system loop as ‘/snap/home-assistant-snap/529/lib’. root@ubuntu:/snap/home-assistant-snap/529# ```

No generally. It just says that the package is already installed. You can check the version in the python interpreter.

Log back into the shell and go into the interpreter with source bin/activate bin/python3

And load the module and print the versio attribute

No generally. It just says that the package is already installed. You can check the version in the python interpreter. Log back into the shell and go into the interpreter with ``` source bin/activate bin/python3 ``` And load the module and print the __versio__ attribute
John commented 1 year ago
Poster

Is this what you were looking for?

root@ubuntu:/snap/home-assistant-snap/529# python -V
Python 3.10.7
(install) root@ubuntu:/snap/home-assistant-snap/529# pip show pymodbus
Name: pymodbus
Version: 2.5.3
Summary: A fully featured modbus protocol stack in python
Home-page: https://github.com/riptideio/pymodbus/
Author: Galen Collins
Author-email: bashwork@gmail.com
License: BSD-3-Clause
Location: /snap/home-assistant-snap/529/lib/python3.10/site-packages
Requires: pyserial, six
Required-by: pysmarty, pystiebeleltron

And can we maybe check what you were proposing to work towards a solution? Not sure if this is a lot to ask from you, but perhaps we can test it on a beta channel?

I'm considering to not include the "requirement_all.txt" file, and let HA install whatever is necessary on demand and only lock down and ship with the bare minimum requirements for HA core - not the integrations.

Is this what you were looking for? ``` root@ubuntu:/snap/home-assistant-snap/529# python -V Python 3.10.7 ``` ``` (install) root@ubuntu:/snap/home-assistant-snap/529# pip show pymodbus Name: pymodbus Version: 2.5.3 Summary: A fully featured modbus protocol stack in python Home-page: https://github.com/riptideio/pymodbus/ Author: Galen Collins Author-email: bashwork@gmail.com License: BSD-3-Clause Location: /snap/home-assistant-snap/529/lib/python3.10/site-packages Requires: pyserial, six Required-by: pysmarty, pystiebeleltron ``` And can we maybe check what you were proposing to work towards a solution? Not sure if this is a lot to ask from you, but perhaps we can test it on a beta channel? > I'm considering to not include the "requirement_all.txt" file, and let HA install whatever is necessary on demand and only lock down and ship with the bare minimum requirements for HA core - not the integrations.
John commented 1 year ago
Poster

I decided to stop using this Snap and roll back to my Docker instances, since it's too important for me that this works. I will definitely try this snap again, but for now I'm rolling back.

Thanks for you efforts Joachim, much appreciated!

I decided to stop using this Snap and roll back to my Docker instances, since it's too important for me that this works. I will definitely try this snap again, but for now I'm rolling back. Thanks for you efforts Joachim, much appreciated!
marecki commented 1 year ago

I had a similar problem with frigate custom component (v4.0.0 https://github.com/blakeblackshear/frigate-hass-integration) that wanted to install pytz 2022.7 but was unable to. Basically the same error message that OP had but with pytz.

Right now I switched to docker because I need frigate, but overall I like snap more because is easier to set up so I hope we can work something out as a solution here

I had a similar problem with frigate custom component (v4.0.0 https://github.com/blakeblackshear/frigate-hass-integration) that wanted to install pytz 2022.7 but was unable to. Basically the same error message that OP had but with pytz. Right now I switched to docker because I need frigate, but overall I like snap more because is easier to set up so I hope we can work something out as a solution here

Hi,

Yes, it's unfortunate. The reason for this is because of conflicting version numbers, between the package that is required by an official integration/component and the package that the custom component require.

Since the official integration is bundled with HA (and so is it's required packages). The bundled software lives in a Readonly filesystem, and that is the reason why requirements for other packages that is installed later on by the user is installed to the user-site.

This works great, until one of the requirements conflicts.

At the moment I'm not sure how to deal with it.

Hi, Yes, it's unfortunate. The reason for this is because of conflicting version numbers, between the package that is required by an official integration/component and the package that the custom component require. Since the official integration is bundled with HA (and so is it's required packages). The bundled software lives in a Readonly filesystem, and that is the reason why requirements for other packages that is installed later on by the user is installed to the user-site. This works great, until one of the requirements conflicts. At the moment I'm not sure how to deal with it.

The current latest release (2023.4) of HA require pytz=2023.3. You can try to use that with the custom_component frigate by editing the requirements in custom_components/frigate/manifest.json and see if it works with the newer version.

The current latest release (2023.4) of HA require `pytz=2023.3`. You can try to use that with the custom_component frigate by editing the requirements in `custom_components/frigate/manifest.json` and see if it works with the newer version.
marecki commented 1 year ago

Thanks, this indeed is a valid workaround

Thanks, this indeed is a valid workaround
Sign in to join this conversation.
No Milestone
No assignee
3 Participants
Loading...
Cancel
Save
There is no content yet.