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.server --help no working #25

Open
mmertama opened this issue Dec 27, 2024 · 5 comments · May be fixed by #26
Open

pymodbus.server --help no working #25

mmertama opened this issue Dec 27, 2024 · 5 comments · May be fixed by #26

Comments

@mmertama
Copy link

installed from pip on macOs
I call "% pymodbus.server --help", and get error "ImportError: cannot import name 'ModbusSocketFramer' from 'pymodbus.transaction'"

@mmertama
Copy link
Author

mmertama commented Dec 27, 2024

Also: poetry run pymodbus.console
Traceback (most recent call last):
File "", line 1, in
import sys; from importlib import import_module; sys.argv = [..../Library/Caches/pypoetry/virtualenvs/pymodbus-repl-l_ijGYq9-py3.13/bin/pymodbus.console']; sys.exit(import_module('pymodbus_repl.client.main').main())
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/importlib/init.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 1022, in exec_module
File "", line 488, in _call_with_frames_removed
File ".../repl/pymodbus_repl/client/main.py", line 15, in
from pymodbus.transaction import (
...<3 lines>...
)
ImportError: cannot import name 'ModbusAsciiFramer' from 'pymodbus.transaction' .../Library/Caches/pypoetry/virtualenvs/pymodbus-repl-l_ijGYq9-py3.13/lib/python3.13/site-packages/pymodbus/transaction/init.py)

@dhoomakethu
Copy link
Contributor

@mmertama pymodbus 3.7.x has some breaking changes and is not compatible with latest repl. Use pymodbus version < 3.7.0

@mmertama
Copy link
Author

When installing repl using poetry/pip it enforces version to 3.8.2, would you mind to change package using interoperable version?

% poetry add pymodbus="3.6.9"

Updating dependencies
Resolving dependencies... (0.2s)

Package operations: 1 install, 0 updates, 0 removals

  - Installing pymodbus (3.6.9)

Writing lock file
% poetry add "pymodbus[.repl]"
Using version ^3.8.2 for pymodbus

Updating dependencies
Resolving dependencies... (0.2s)

Package operations: 0 installs, 1 update, 0 removals

  - Updating pymodbus (3.6.9 -> 3.8.2)

Writing lock file

@dhoomakethu
Copy link
Contributor

dhoomakethu commented Dec 29, 2024

The latest main has the restriction on pymodbus. Refer https://github.com/pymodbus-dev/repl/blob/main/pyproject.toml#L31
Please run poetry update and see if that fixes

pymodbus-repl on  main [$!?] is 📦 v2.0.5 via 🐍 v3.11.6 (venv)
❯ poetry show pymodbus
Configuration file exists at /Users/sanjay/Library/Preferences/pypoetry, reusing this directory.

Consider moving TOML configuration files to /Users/sanjay/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
 name         : pymodbus
 version      : 3.7.0
 description  : A fully featured modbus protocol stack in python

pymodbus-repl on  main [$!?] is 📦 v2.0.5 via 🐍 v3.11.6 (venv)
❯ pymodbus.server --help

 Usage: pymodbus.server [OPTIONS] COMMAND [ARGS]...

 Reactive Modbus server

╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --host                                  TEXT     Host address [default: localhost]                                         │
│ --web-port                              INTEGER  Web app port [default: 8080]                                              │
│ --repl                  --no-repl                Enable/Disable repl for server [default: repl]                            │
│ --verbose               --no-verbose             Run with debug logs enabled for pymodbus [default: no-verbose]            │
│ --install-completion                             Install completion for the current shell.                                 │
│ --show-completion                                Show completion for the current shell, to copy it or customize the        │
│                                                  installation.                                                             │
│ --help                                           Show this message and exit.                                               │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ run              Run Reactive Modbus server.                                                                               │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

@dhoomakethu
Copy link
Contributor

pymodbus-repl on  main [$!?] is 📦 v2.0.5 via 🐍 v3.11.6 (venv)
❯ poetry run pymodbus.console
Configuration file exists at ~/Library/Preferences/pypoetry, reusing this directory.

Consider moving TOML configuration files to ~/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
Usage: pymodbus.console [OPTIONS] COMMAND [ARGS]...

  Run Main.

Options:
  --version          Show the version and exit.
  --verbose          Verbose logs
  --retries INTEGER  Retry count
  --help             Show this message and exit.

Commands:
  serial  Define serial communication.
  tcp     Define TCP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants