Traceback importlib.metadata.PackageNotFoundError: ospd-openvas

Looking for an assist to identify root of traceback when running ospd-openvas for first time

gvm@kali:~$ /usr/bin/python3 /opt/gvm/bin/ospd-openvas --pid-file /opt/gvm/var/run/ospd-openvas.pid --log-file /opt/gvm/var/log/gvm/ospd-openvas.log --lock-file-dir /opt/gvm/var/run -u /opt/gvm/var/run/ospd.sock DEBUG -f
Traceback (most recent call last):
  File "/opt/gvm/bin/ospd-openvas", line 33, in <module>
    sys.exit(load_entry_point('ospd-openvas==1.0.1', 'console_scripts', 'ospd-openvas')())
  File "/opt/gvm/bin/ospd-openvas", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
  File "/usr/lib/python3.8/importlib/metadata.py", line 504, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.8/importlib/metadata.py", line 177, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: ospd-openvas

This is the ospd-openvas file:

#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'ospd-openvas==1.0.1','console_scripts','ospd-openvas'
import re
import sys

# for compatibility with easy_install; see #2198
__requires__ = 'ospd-openvas==1.0.1'

try:
    from importlib.metadata import distribution
except ImportError:
    try:
        from importlib_metadata import distribution
    except ImportError:
        from pkg_resources import load_entry_point


def importlib_load_entry_point(spec, group, name):
    dist_name, _, _ = spec.partition('==')
    matches = (
        entry_point
        for entry_point in distribution(dist_name).entry_points
        if entry_point.group == group and entry_point.name == name
    )
    return next(matches).load()


globals().setdefault('load_entry_point', importlib_load_entry_point)


if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(load_entry_point('ospd-openvas==1.0.1', 'console_scripts', 'ospd-openvas')())

Hi,
this looks a bit outdated with version 1.0.1 and your gvm-11 tag.
You should consider updating to the 20.8 versions of all components.
For the stacktrace, maybe the package is not correctly installed. Latest version available through pip3 is:

$ pip3 search ospd
ospd (20.8.1)          - OSPD is a base for scanner wrappers which share the same communication protocol: OSP (Open Scanner Protocol)
ospd-openvas (20.8.0)  - ospd based scanner for openvas

Cheers,
Carl

1 Like

This error always means you did break your Python package installation in some way. This is not GVM specific and a generic Python issue. Please try to re-install the Python packages.

1 Like