Page 1 of 1

Nagios LogServer Installation always fails with ImportError:

Posted: Mon Jul 12, 2021 6:34 am
by toomanyairmiles
I'm attempting to install Nagios LogServer on to a virgin CentOS 7.2.1511 using

Code: Select all

curl https://assets.nagios.com/downloads/nagios-log-server/install.sh | sh
I get this initial error

Code: Select all

    Downloading https://files.pythonhosted.org/packages/21/83/308a74ca1104fe1e3197d31693a7a2db67c2d4e668f20f43a2fca491f9f7/click-8.0.1.tar.gz (327kB)
        Complete output from command python setup.py egg_info:
        error in click setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers
        
        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-fy2L78/click/
    You are using pip version 8.1.2, however version 21.1.3 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
Then run

Code: Select all

pip install --upgrade pip
And re-run the installation, getting

Code: Select all

    Traceback (most recent call last):
      File "/usr/bin/pip", line 9, in <module>
        load_entry_point('pip==21.1.3', 'console_scripts', 'pip')()
      File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
        return get_distribution(dist).load_entry_point(group, name)
      File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
        return ep.load()
      File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
        entry = __import__(self.module_name, globals(),globals(), ['__name__'])
      File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 1, in <module>
        from typing import List, Optional
    ImportError: No module named typing
I've attempted a variety of solutions, for example, re-templating the server, installing python 2.7, running `pip install typing` and then running the installation. This results in

Code: Select all

     Complete output from command python setup.py egg_info:
        error in click setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers
And a prompt to update pip. Upgrading pip either before or after the installation results in

Code: Select all

    Traceback (most recent call last):
      File "/usr/bin/pip", line 9, in <module>
        load_entry_point('pip==21.1.3', 'console_scripts', 'pip')()
      File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
        return get_distribution(dist).load_entry_point(group, name)
      File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
        return ep.load()
      File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
        entry = __import__(self.module_name, globals(),globals(), ['__name__'])
      File "/usr/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 58
        sys.stderr.write(f"ERROR: {exc}")
                                       ^
    SyntaxError: invalid syntax

Re: Nagios LogServer Installation always fails with ImportEr

Posted: Mon Jul 12, 2021 11:44 am
by pbroste
Hello,

Thanks for reaching out, and want to start off by receiving some more information about your python environment.

Please provide the results from the following commands:
  • python -V
  • which python
  • pip -V
Also install the 'setuptools' for python.

Code: Select all

pip install --upgrade setuptools
Thanks,
Perry

Re: Nagios LogServer Installation always fails with ImportEr

Posted: Mon Jul 12, 2021 12:43 pm
by pbroste
To follow up on my previous post, after doing further research we see that you are probably hitting a bug and in the fullinstall after line number 107 please make the following edit to the fullinstall script, by adding pipextra='click<8.0.0'

  • pip="python-pip"
    if [ "$dist" == "el7" ]; then
    pip="python2-pip"
    # click 8.0.0 in incompatible with python 2.x
    pipextra='click<8.0.0'
    elif [ "$dist" == "el8" ]; then
    pip="python3-pip"
    else
    pipextra="urllib3==1.22"
    fi
Thanks,
Perry

Re: Nagios LogServer Installation always fails with ImportEr

Posted: Mon Jul 12, 2021 12:56 pm
by toomanyairmiles
Perry, the install script I'm running is on your server, I don't have a local copy.

Please also let me know precisely which one of the multiple errors I'm experience this is supposed to fix, and if you've fixed it in the publicly available script.

Re: Nagios LogServer Installation always fails with ImportEr

Posted: Mon Jul 12, 2021 2:21 pm
by cdienger
Hi @toomanyairmiles,

The script you are running downloads the latest vesrion of NLS, unpacks it, and runs the installation locally. The problems stem from this error:

Code: Select all

Downloading https://files.pythonhosted.org/packages/21/83/308a74ca1104fe1e3197d31693a7a2db67c2d4e668f20f43a2fca491f9f7/click-8.0.1.tar.gz (327kB)
        Complete output from command python setup.py egg_info:
        error in click setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers
This will be fixed in 2.1.9 which is currently in QA. In the meantime, I would suggest downloading and unpacking it with the following commands:

Code: Select all

cd /tmp
wget https://assets.nagios.com/downloads/nagios-log-server/nagioslogserver-latest.tar.gz
tar xzf nagioslogserver-latest.tar.gz
The next step is to run the fullinstall script but this will fail unless patched. Replace the /tmp/nagioslogserver/fullinstall file with the one attached(I had to give it a .txt extension just to allow it to attach to this post) and then run to run the installer:

Code: Select all

mv fullinstall.txt fullinstall
cp fullinstall /tmp/nagioslogserver/fullinstall
chmod 755 /tmp/nagioslogserver/fullinstall
cd /tmp/nagioslogserver/
./fullinstall