zabbix / python-zabbix-utils

Python library "zabbix-utils"
MIT License
114 stars 16 forks source link

installation is not working on debian cause PEP 668 #15

Closed colttt closed 3 months ago

colttt commented 5 months ago

You need to change your configuration, cause a simple installation is not possible on Debian 12 systems:

root@monitoring:~# pip install zabbix_utils
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.
tuxick commented 4 months ago
mkdir zabbix-api
cd zabbix-api
python -m venv venv
source venv/bin/activate
pip install zabbix_utils

Remember you might need to source venv/bin/activate again

aiantsen commented 3 months ago

@colttt, thank you for your comment. According to PEP68 a Python-specific tool like pip should guide the user towards using Python Virtual Environments (venv) instead of installing or uninstalling the package into the interpreter's default installation environment. The main idea behind this is to encourage users to use a venv. You can use the approach suggested by @tuxick to create a venv. Therefore, the current description in the README file can be considered correct. If you're sure and intented to install the package to the default/global environment, you can use pipx instead of pip, pip3 and so.

@tuxick, thanks for your comment and willingness to help @colttt.