Validation gives a warning about Python dependencies check not running as user librenms

I installed Librenms on Ubuntu 18.
everything looks good except when I run the validation, I get :
[WARN] Could not check Python dependencies because this script is not running as librenms
any suggestion on how to fix this ?
thank you in advance.

Are you running validate as librenms user?

1 Like

if I run (./validate.php) as root or as my regular user account, I get that warning message
if I run it as librenms, that message doesn’t appear.
if I do the validation from the web interface, I get that message aswell (Warning: Could not check Python dependencies because this script is not running as librenms)

is this a permission issue ?

I have 2 installation of librenms, one that works fine and one with the issue I described in the post.
the one that works, validate.php has this permission : -rwxrwxr-x
the one giving the warning, validate.php has this permission : -rwxr-xr-x

having the same issue regardless what the permissions are for validate.php

Running PHP 7.4 on Ubuntu 20.04 LTS

Install requirements as root and you should stop seeing that message.

Said that, all librenms commands should be run as librenms user, or you could cause permissions issues.

All the commands were executed as root. first I tried using sudo -i then reinstalled ubuntu from scratch, enabled root and used it for the installation. I got same result.

I followed the standard installation guideline available in LibreNMS website: https://docs.librenms.org/Installation/Installation-Ubuntu-1804-Apache/

I executed the commands using ‘root’ user inside Ubuntu 18 container.

But, it did not work and generated Python dependency warning.

So, how could I get the solution in this case?

The issue is that those dependencies in the web server are shown because apache/nginx doesn’t have access to that environment (inside librenms user). Installing those dependencies in the system (system-wide) should fix the issue. Had the same thing happen to me, was fixed by installing it as root via yum (CentOS).

Thanks for the reply! Can you be more precise on how to fix the issue?

If you get this message when you are running validate.php as a non-librenms user and not when you run it as librenms. That means the dependencies are installed into the librenms user’s home directory. When you run python as another user, it cannot access those dependencies.

Only the librenms user needs access to the dependencies. python is NEVER run in the webserver or as root. If validate.php as librenms is good, you are good.

Now that you know everything is ok. If you want to get the warning to go away, simply install the dependencies into the system as root, that way all users have access to them. Many systems do not have new enough python packages in their repository so this likely means using pip3 to install them. (at the time of this writing at least Debian 10 and Ubuntu 20.04 can use apt packages)

2 Likes

How does one check which python packages are missing?

./scripts/check_requirements.py -v

Thanks, the “check_requirements.py” script helped me identify what was missing, in my case adding the following packages to Ubuntu-20.04 solved the issue in the web portal.

apt install python3-dotenv python3-pymysql python3-redis

.
The full set of packages I installed before following the installation instructions is now:

apt install software-properties-common
apt update
apt install acl composer curl fping git graphviz imagemagick
apt install mariadb-client mariadb-server mtr-tiny
apt install nginx-full nmap rrdtool snmp snmpd unzip whois
apt install php7.4-cli php7.4-curl php7.4-fpm php7.4-gd php7.4-json php7.4-mbstring
apt install php7.4-mysql php7.4-snmp php7.4-xml php7.4-zip
apt install python3-dotenv python3-memcache python3-mysqldb python3-pip
apt install python3-pymysql python3-redis
apt install smokeping

Everything seems to working OK so far…

1 Like

For CentOS 7, I just had to add this one command to clear the warning in the Web validation page:

yum install python36-PyMySQL

You need the pymysql library for whatever your system version of python 3 is. This will vary. Check python3 --version and which python3

For CentOS 7, I did a
yum search PyMySQL
and then installed the version for Python 3 that appeared.

I did get an option for python2, but since we are currently in the last days of python 2 being supported, I felt confident in ignoring that.

I was just pointing out that following the LibreNMS install docs, this was the one thing I did that corrected the final error on the validation.php web page. You have a point that it may require a different version this time next year, so an accurate way to identify the correct package is helpful.