pymodbus-dev / pymodbus

A full modbus protocol written in python
Other
2.29k stars 938 forks source link

Issue in installing pymodbus #1876

Closed HackersSpirit closed 1 year ago

HackersSpirit commented 1 year ago

Versions

Pymodbus Specific

I attempted to install Pymodbus using pip, but it was not possible on my Ubuntu version. As a result, I had to resort to using the following command: sudo apt-get install python3-pymodbus, which installed Pymodbus version 3.0.0rc1. Unfortunately, my application necessitates the installation of Pymodbus without the use of a virtual environment. If you could provide guidance on achieving this, I would greatly appreciate it.

janiversen commented 1 year ago

You do not provide a copy of the error and the command you use, so it's quite impossible to help you. Please read the documentation on how to use pip.

Our CI runs on ubuntu and installs using pip, so it seems to work.

The command you refer to is not part of this library, so I have no idea what it installs.

janiversen commented 1 year ago

Pymodbus can be used with or without a virtual environment, that is in reality something that concerns python3 outside of pymodbus.

depending on what you need "pip install pymodbus" works. If your pip is too old you will get a warning. This is all documented in our README.

janiversen commented 1 year ago

and please update pymodbus, v3.0.0rc1 have quite a number of bug.

HackersSpirit commented 1 year ago

@janiversen : On my ubuntu machine I get the following message after giving the command

  1. pip3 install pymodbus error: externally-managed-environment

× This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification.

  1. sudo apt-get install python3-pymodbus runs and install Pymodbus: 3.0.0rc1
janiversen commented 1 year ago

That seems to be a matter of your ubuntu system and not the library

we use ubuntu 22.04:

image

and as you can see pip does the install very well (the . is because we install from a git clone).

Your ubuntu comes with a pymodbus version, that is very old. The error message tells you how to overwrite that package —break..

so you have a clear choice use virtual environment or overwrite the system managed version.

HackersSpirit commented 1 year ago

It seems like we can no longer install packages on Ubuntu 23 and later versions using pip because they can create conflicts with system package so only way to install it is using virtual environment

janiversen commented 1 year ago

That might be, I have no idea. Did you try the --break-something, because it did not say it WILL break system packages just that it was a possibility.

Independent of this, this is not something we influence nor have the slightest control over, please make an issue in ubuntu.

janiversen commented 1 year ago

Closing this, as this is a ubuntu issue, rather than a pymodbus issue.

2 solutions have been suggested:

alexrudd2 commented 1 year ago
* Use "pip --break-system-packages", which might break the system (but most likely won't, since the system do not use pymodbus)

Yes. this is what I do for Python 3.12 and it's fine.