I installed a virtual environment with virtualenv --python python3.8 /omd/sites/openvas . openvas is the user for my new Nagios-Site.
after that i did export PATH=$PATH:$USER/omd/sites/openvas/.
And so i was able to install python-gvm and gvm-tools.
Well, that what i did could be terribly wrong (yes i did a snapshot before). I do not know it better.
I thought installing a virtualenv and exporting the pythonpath to same directory could solve my problem .
Unfortunately commands with gvm-cli are not found.
I really need some help there
seems like i totally wracked it. OMD[openvas]:~/gvm/python-gvm$ python3 -m pip install --user python-gvm ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
and i cant get rid of the virtualenv with any rm commands
this is a typical Python installation issue. You need to understand Python modules and how they get loaded from the interpreter. Python virtual environments help you to separate installations to be able to install different versions of one module. Please read https://realpython.com/python-virtual-environments-a-primer/ for an introduction to virtual environments.
To fix your issue please create a fresh new virtual Python environment, activate that environment (source /path/to/env/bin/activate), update pip in the environment (pip install -U pip) and afterwards install gvm-tools without --user switch (pip install gvm-tools). You don’t need (and even can’t use) the --user option within virtual environments. It even doesn’t make sense if you understand them.
thank you for the answer. Ive tried out your advice, installed a new virtualenv, activated it, updated pip and installed gvm-tools inside the virtualenv (installvirtenv) OMD[openvas]:~/gvm/installvirtenv/gvm-tools$ pip install gvm-tools
I just did exactly the same steps on a testmachine and it works just fine.
But all i did on my nagios server was installing check_mk, creating a site with the name “gvm” and trying to install gvm-tools under the created user “gvm”
I am really not sure what you are doing. The virtualenv must be created with the same user you wanted to use gvm-tools with of course. Please just follow my advises. If you are within a virtualenv the applications are available in your PATH. You should really read the article at real python (https://realpython.com/python-virtual-environments-a-primer/) to understand virtual environments.
The User is automatically created with the new Nagios “Site”. Under this user i created a virtualenv.
I activate the virtualelenv and inside there, i updated pip and installed “python-gvm” and “gvm-tools” without --user -option.
My python executable in virtualenv (env) OMD[gvm]:~/virtualenv$ which python /opt/omd/sites/gvm/virtualenv/env/bin/python
The Path gives me (env) OMD[gvm]:~/virtualenv$ echo $PATH /opt/omd/sites/gvm/virtualenv/env/bin:/omd/sites/gvm/lib/perl5/bin:/omd/sites/gvm/local/bin:/omd/sites/gvm/bin:/omd/sites/gvm/local/lib/perl5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin, which looks in the first entry of my virtualenv.
For me it looks correct.
As i said i tried this for the user which comes with creating a new nagios site.
If i do exactly same steps with any other user which was not created by a new Site, then it works fine like it should.