pythonpymodbus

from pymodbus.server.asynchronous import StartTcpServer ModuleNotFoundError: No module named 'pymodbus'


I have trying to import pymodbus module for an simulation of oil refinery. but even after install I am getting an error like this:

from pymodbus.server.asynchronous import StartTcpServer
ModuleNotFoundError: No module named 'pymodbus'

I have checked the installed pip modules and the module was available through `python -m pip list.

Package                    Version
-------------------------- ------------
absl-py                    1.0.0
ale-py                     0.7.5
appdirs                    1.4.4
astor                      0.8.1
attrs                      22.1.0
audioread                  2.1.9
Automat                    20.2.0
AutoROM                    0.4.2
AutoROM.accept-rom-license 0.4.2
backcall                   0.2.0
cached-property            1.5.2
certifi                    2021.10.8
cffi                       1.15.0
charset-normalizer         2.0.12
click                      8.1.3
cloudpickle                2.0.0
colorama                   0.4.4
constantly                 15.1.0
cycler                     0.11.0
debugpy                    1.6.0
decorator                  5.1.1
entrypoints                0.4
fonttools                  4.33.3
gast                       0.2.2
google-pasta               0.2.0
grpcio                     1.46.0
gym                        0.21.0
gym-notices                0.0.6
h5py                       3.6.0
hyperlink                  21.0.0
idna                       3.3
importlib-metadata         4.11.3
importlib-resources        5.7.1
incremental                21.3.0
ipykernel                  6.13.0
ipython                    7.33.0
jedi                       0.18.1
joblib                     1.1.0
jupyter-client             7.3.0
jupyter-core               4.10.0
keras                      2.8.0
Keras-Applications         1.0.8
Keras-Preprocessing        1.1.2
kiwisolver                 1.4.2
librosa                    0.9.1
llvmlite                   0.38.0
Markdown                   3.3.7
matplotlib                 3.5.2
matplotlib-inline          0.1.3
nest-asyncio               1.5.5
numba                      0.55.1
numpy                      1.21.6
opencv-python              4.6.0.66
opt-einsum                 3.3.0
packaging                  21.3
pandas                     1.1.5
parso                      0.8.3
pickleshare                0.7.5
Pillow                     9.1.0
pip                        21.3.1
pooch                      1.6.0
prompt-toolkit             3.0.29
protobuf                   3.20.1
typing_extensions          4.2.0
urllib3                    1.26.9
wcwidth                    0.2.5
Werkzeug                   2.1.2
wheel                      0.37.1
wrapt                      1.14.1
zipp                       3.8.0
zope.interface             5.4.0

I am using python 3.9.0 version Is there anything I am missing? Thanks in advance.


Solution

  • I solved the issue only by changing the lib. Just install pymodbus3 instead of pymodbus. Therefore, anywhere in your code, replace pymodbus with pymodbus3.

    Exp:

    from pymodbus.server.asynchronous import StartTcpServer
    

    changes to:

    from pymodbus3.server.asynchronous import StartTcpServer