Installation

Requirements

  • Python 3.9 or higher

  • pyserial >= 3.5 (for RTU transport)

Install from PyPI

The easiest way to install ModbusLink is using pip:

pip install modbuslink

Install from Source

You can also install ModbusLink from the source code:

git clone https://github.com/Miraitowa-la/ModbusLink.git
cd ModbusLink
pip install -e .

Development Installation

For development, install with additional dependencies:

git clone https://github.com/Miraitowa-la/ModbusLink.git
cd ModbusLink
pip install -e ".[dev]"

This will install additional packages for testing and documentation:

  • pytest

  • pytest-asyncio

  • pytest-mock

  • sphinx

  • sphinx-rtd-theme

  • black

  • ruff

  • mypy

Verify Installation

To verify that ModbusLink is installed correctly, run:

import modbuslink
print(modbuslink.__version__)

Optional Dependencies

For RTU communication over serial ports:

pip install pyserial

For documentation building:

pip install sphinx sphinx-rtd-theme

For testing:

pip install pytest pytest-asyncio pytest-mock

Troubleshooting

Common Issues

ImportError: No module named ‘serial’

This error occurs when pyserial is not installed. Install it with:

pip install pyserial

Permission denied on serial port (Linux/macOS)

Add your user to the dialout group:

sudo usermod -a -G dialout $USER

Then log out and log back in.

Windows serial port access issues

Ensure the serial port is not being used by another application and that you have the correct drivers installed.