Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyModbus 3.0 module is not found - although the module has been installed #1126

Closed
Jmmx1237 opened this issue Oct 21, 2022 · 3 comments
Closed

Comments

@Jmmx1237
Copy link

Jmmx1237 commented Oct 21, 2022

Versions

  • Python: 3.9
  • OS: Rasbian Os (bullseye)
  • Pymodbus: 3.0
  • Modbus Hardware (if used): Wago 750

Pymodbus Specific

  • Server: tcp - sync
  • Client: tcp - sync

Description

On my new hardware with the latest Linux Rasbian OS (Bullseye), my Pymodbus script no longer runs. Somehow, I can not get the PyModbus 3.0 module installed correctly.

On my old system, my script runs with an older version of Pymodbus without any problems:

My Old system

pip3 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: /home/philo/.local/lib/python3.8/site-packages
Requires: six, pyserial
Required-by:

How do I get this to work, should I maybe downgrade my python version?

New System

~/python-skripte $ pip3 show pymodbus
Name: pymodbus
Version: 3.0.0
Summary: A fully featured modbus protocol stack in python
Home-page: https://github.com/riptideio/pymodbus/
Author: attr: pymodbus.author
Author-email: None
License: BSD-3-Clause
Location: /home/philo/.local/lib/python3.9/site-packages
Requires:
Required-by:

Error

~/python-skripte $ python3 websocketserver3.py
Traceback (most recent call last):
File "/home/philo/python-skripte/websocketserver3.py", line 9, in
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
ModuleNotFoundError: No module named 'pymodbus.client.sync'

~/python-skripte $ sudo python3 websocketserver3.py
Traceback (most recent call last):
File "/home/philo/python-skripte/websocketserver3.py", line 9, in
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
File "/usr/local/lib/python3.9/dist-packages/pymodbus/client/init.py", line 5, in
from pymodbus.client.serial import AsyncModbusSerialClient, ModbusSerialClient
File "/usr/local/lib/python3.9/dist-packages/pymodbus/client/serial.py", line 7, in
from serial_asyncio import create_serial_connection
ModuleNotFoundError: No module named 'serial_asyncio'

@janiversen
Copy link
Collaborator

Please read the documentation !

Pymodbus.client.sync no longer exist it is now Pymodbus.client.

You also have not installed serial_asyncio.

There are (as noted) a number of important changes between 2.5.3 and 3.0.0 (as signalled by the change 2 -> 3) and you need you need to modify your script and environment accordingly.

@Jmmx1237
Copy link
Author

Jmmx1237 commented Oct 21, 2022

Thank you very much, my script was modified and seems now to run perfectly... I don't use asyncio in my script either, at least it wasn't imported.

@janiversen
Copy link
Collaborator

There is a known bug in 3.0.0 that demands serial_asyncio to be installed, but if your scripts works then its fine.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants