pymodbus-dev / pymodbus

A full modbus protocol written in python
Other
2.22k stars 907 forks source link

pymodbusserial doesn't exist #1895

Closed yokusrelynkno closed 9 months ago

yokusrelynkno commented 9 months ago

Versions

Pymodbus Specific

Description

This link gives below example:

If you want to use the serial interface:

pip install -U pymodbus[serial]

Same in github README.

I'm not sure what I'm missing? @janiversen

pymodbusserial package can't be installed through pip and thus program gives 'serial' not defined error during runtime. Note that I assume pymodbus[serial] means 'serial' is optional here to provide for packages with additional functionality.

Code and Logs

Installed pip packages inside venv:

$python -V
Python 3.11.0

$python -m pip list
Package            Version
------------------ ------------
pymodbus           3.5.4
...
pyserial           3.5
...

$pip install pymodbus
Requirement already satisfied: pymodbus in ./.pyenv/versions/venv3-11/lib/python3.11/site-packages (3.5.4)

$pip install pymodbusserial
ERROR: Could not find a version that satisfies the requirement pymodbusserial (from versions: none)
ERROR: No matching distribution found for pymodbusserial

$pip install pymodbusall
ERROR: Could not find a version that satisfies the requirement pymodbusall (from versions: none)
ERROR: No matching distribution found for pymodbusall

transport_serial.py


with contextlib.suppress(ImportError):
    import serial

class SerialTransport(asyncio.Transport):
    """An asyncio serial transport."""

    def __init__(self, loop, protocol, *args, **kwargs):
        """Initialize."""
        super().__init__()
        self.async_loop = loop
        self._protocol = protocol
        self.sync_serial = serial.serial_for_url(*args, **kwargs)

Runtime error I'm getting because import serial doesn't work:

WARNING |pymodbus.logging|Failed to connect UNKNOWN EXCEPTION name 'serial' is not defined
janiversen commented 9 months ago

Please install serial as pr documentation, instead of as you try to do.

Please do not open multiple issues with the same theme, this is not a pymodbus problem, but a problem in how you use pip.

yokusrelynkno commented 9 months ago

I see, thank you. I thought once you closed the issue, you wouldn't see my answer. Thank you anyways. @janiversen