Python installation

It is required by AI Xbot, Prediction graphs and Anomaly detection.
Such features require Python 3.11 or newer.
You can run XorMon even without that if you have trouble downloading necessary Python modules.

  • Check installed Python versions
    ls -ls /usr/bin/python*
    Example:
    lrwxrwxrwx 1 root root     9 Aug  4 13:28 /usr/bin/python3 -> python3.6
    -rwxr-xr-x 1 root root  6288 Nov 24 15:30 /usr/bin/python3.12
    -rwxr-xr-x 1 root root  3378 Nov 24 15:30 /usr/bin/python3.12-config
    -rwxr-xr-x 2 root root 10560 Aug  4 13:28 /usr/bin/python3.6
    lrwxrwxrwx 1 root root    17 Aug  4 13:28 /usr/bin/python3.6-config -> python3.6m-config
    -rwxr-xr-x 2 root root 10560 Aug  4 13:28 /usr/bin/python3.6m
    -rwxr-xr-x 1 root root  3440 Aug  4 13:28 /usr/bin/python3.6m-config
    lrwxrwxrwx 1 root root    16 Aug  4 13:28 /usr/bin/python3-config -> python3.6-config
    python3.12 is available in the above example.

  • Install the version of Python corresponding to your operating system
    Required python packages: venv/virtualenv, dev/develop, pip
    Installation example:
    # RHEL / Rocky Linux
    sudo dnf install python3.12 python3.12-pip python3.12-devel
    
    # Debian / Ubuntu
    apt install python3.12 python3.12-dev python3.12-venv
    (Detailed procedure is beyond the scope of this guide.)

  • Log in as 'xormon' and create Python3 virtual environment

    Use the version of Python obtained in the previous step.
    We will use python3.12 in our example.
    cd ~/xormon-ng/server-nest/
    python3.12 -m venv venv
    
    # Prediction and Alerting dependencies
    venv/bin/python3 -m ensurepip --upgrade
    venv/bin/python3 -m pip install --upgrade pip
    venv/bin/python3 -m pip install -r microservices/analyzer/requirements/requirements.txt
    
    # AI Xbot dependencies
    python3.12 -m venv pyxbotagent/.venv
    pyxbotagent/.venv/bin/python -m pip install --upgrade pip
    pyxbotagent/.venv/bin/python -m pip install -r pyxbotagent/requirements.txt
    If you get this error:
    Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/pip/
    Then try to avoid it by using internal proxy for Python packages installation
    venv/bin/python3 -m pip install --proxy http://<username>:<password>@<hostname>:<port> --upgrade pip
    venv/bin/python3 -m pip install --proxy http://<username>:<password>@<hostname>:<port> -r microservices/analyzer/requirements/requirements.txt 
  • Restart XorMon
    cd ~/xormon-ng
    ./xormon.sh stop
    ./xormon.sh start