python-3.xlinuxlibvirtrocky-os

Installation Failure of libvirt-python on Rocky Linux 9: pkg-config Cannot Find libvirt


I'm trying to install libvirt-python version 8.4.0 on Rocky Linux 9, but I'm encountering an error during the installation process. Despite having installed all the necessary libvirt related packages, pkg-config cannot find the required libvirt configuration files.

Error Message:

ERROR: Command errored out with exit status 1:
     command: /home/muhammadusman/Development/vmware-daemon/env/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-28b6begr/libvirt-python_9055ea157e0d410781196d89678e0c0b/setup.py'"'"'; __file__='"'"'/tmp/pip-install-28b6begr/libvirt-python_9055ea157e0d410781196d89678e0c0b/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-da0lrk9d/install-record.txt --single-version-externally-managed --compile --install-headers /home/muhammadusman/Development/vmware-daemon/env/include/site/python3.10/libvirt-python
         cwd: /tmp/pip-install-28b6begr/libvirt-python_9055ea157e0d410781196d89678e0c0b/
    Complete output (45 lines):
    Package libvirt was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libvirt.pc'
    to the PKG_CONFIG_PATH environment variable
    Package 'libvirt', required by 'virtual:world', not found
    Package libvirt was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libvirt.pc'
    to the PKG_CONFIG_PATH environment variable
    Package 'libvirt', required by 'virtual:world', not found
    running install
    running build
    running build_py
    Package 'libvirt' was not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-28b6begr/libvirt-python_9055ea157e0d410781196d89678e0c0b/setup.py", line 328, in <module>
        setup(name = 'libvirt-python',
      File "/home/muhammadusman/Development/vmware-daemon/env/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/usr/local/lib/python3.10/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/lib/python3.10/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/local/lib/python3.10/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/muhammadusman/Development/vmware-daemon/env/lib/python3.10/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/local/lib/python3.10/distutils/command/install.py", line 568, in run
        self.run_command('build')
      File "/usr/local/lib/python3.10/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/lib/python3.10/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.10/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/local/lib/python3.10/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/lib/python3.10/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/tmp/pip-install-28b6begr/libvirt-python_9055ea157e0d410781196d89678e0c0b/setup.py", line 152, in run
        check_minimum_libvirt_version()
      File "/tmp/pip-install-28b6begr/libvirt-python_9055ea157e0d410781196d89678e0c0b/setup.py", line 43, in check_minimum_libvirt_version
        subprocess.check_call(["pkg-config",
      File "/usr/local/lib/python3.10/subprocess.py", line 369, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['pkg-config', '--print-errors', '--atleast-version=0.9.11', 'libvirt']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/muhammadusman/Development/vmware-daemon/env/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-28b6begr/libvirt-python_9055ea157e0d410781196d89678e0c0b/setup.py'"'"'; __file__='"'"'/tmp/pip-install-28b6begr/libvirt-python_9055ea157e0d410781196d89678e0c0b/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-da0lrk9d/install-record.txt --single-version-externally-managed --compile --install-headers /home/muhammadusman/Development/vmware-daemon/env/include/site/python3.10/libvirt-python Check the logs for full command output.

Steps Taken:

  1. I have installed the following packages which I thought might include the necessary development files:
    • libvirt
    • libvirt-client
    • libvirt-libs
    • etc.

Question: Are there specific packages for development files in Rocky Linux 9 that I might be missing? How can I correctly configure pkg-config to find libvirt on Rocky Linux 9?

Thank you in advance for any help or insights you can provide!


Solution

  • You need to install 'libvirt-devel', which provides the development header files