Di recente mi è capitato di validare la configurazione di LibreNMS ed ho notato la comparsa di un errore relativo al Python.
L’errore nello specifico è il seguente:
FAIL: Python3 module issue found: ‘Required packages: [‘PyMySQL!=1.0.0’, ‘python-dotenv’, ‘redis>=4.0’, ‘setuptools’, ‘psutil>=5.6.0’, ‘command_runner>=1.3.0’] Package not found: The ‘command_runner>=1.3.0’ distribution was not found and is required by the application ’
Fix:
pip3 install -r /opt/librenms/requirements.txt
PROBLEMA
A questo punto per fixare accedere al server in SSH e digitare il comando:
0 |
pip3 install -r /opt/librenms/requirements.txt
|
Nel mio caso ho riscontrato il seguente errore:
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
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.12/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.
|
SOLUZIONE
Per risolvere questo problema, sempre dalla console SSH, eseguire il comando:
0 |
pip3 install command_runner --break-system-packages
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
5
6
7
8
9
10
|
pip3 install command_runner --break-system-packages
Collecting command_runner
Downloading command_runner-1.7.0-py3-none-any.whl.metadata (26 kB)
Collecting psutil>=5.6.0 (from command_runner)
Downloading psutil-6.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (21 kB)
Downloading command_runner-1.7.0-py3-none-any.whl (25 kB)
Downloading psutil-6.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (290 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 290.5/290.5 kB 17.1 MB/s eta 0:00:00
Installing collected packages: psutil, command_runner
Successfully installed command_runner-1.7.0 psutil-6.0.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
|
Collegarsi all’interfaccia web ed eseguire la Validazione.
Se è andato tutto a buon fine dovremmo visualizzare una schermata come quella sovrastante dove è possibile notare che l’errore relativo al Python è scomparso.
Sono Raffaele Chiatto, un appassionato di informatica a 360°…
Mi sono avvicinato al mondo dell’informatica nel lontano 1996 con Windows 95 e da allora non ho più smesso di dedicarmi allo studio ed approfondimento di questo settore.
Laureato in Ingegneria Informatica nel 2009, lavoro nel campo dell’IT dal lontano 2001.
0 commenti