0

I want to use libvirt library for installing a VM on a KVM. While installing libvirt library on Mac, I'm coming across an issue. I tried installing libvirt dependencies but to no use. Can you please help me with this.

(venv) Siddharaths-MacBook-Pro-2:Homework1 siddharathgupta$ pip install libvirt-python
Collecting libvirt-python
  Using cached https://files.pythonhosted.org/packages/73/37/52c7076b1b44efe4157d0744be7be01df0c0942f44daba458a77a19f9f8d/libvirt-python-4.10.0.tar.gz
Building wheels for collected packages: libvirt-python
  Running setup.py bdist_wheel for libvirt-python ... error
  Complete output from command /Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-wheel-WnOPln --python-tag cp27:
  running bdist_wheel
  running build
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 366, in <module>
      "Programming Language :: Python :: 3",
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
      dist.run_commands()
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
      self.run_command(cmd)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/lib/python2.7/site-packages/wheel/bdist_wheel.py", line 202, in run
      self.run_command('build')
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 147, in run
      check_minimum_libvirt_version()
    File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 40, in check_minimum_libvirt_version
      spawn([get_pkgcfg(),
    File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 36, in get_pkgcfg
      raise Exception("pkg-config binary is required to compile libvirt-python")
  Exception: pkg-config binary is required to compile libvirt-python

  ----------------------------------------
  Failed building wheel for libvirt-python
  Running setup.py clean for libvirt-python
Failed to build libvirt-python
Installing collected packages: libvirt-python
  Running setup.py install for libvirt-python ... error
    Complete output from command /Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-record-4drvGZ/install-record.txt --single-version-externally-managed --compile --install-headers /Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/include/site/python2.7/libvirt-python:
    running install
    running build
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 366, in <module>
        "Programming Language :: Python :: 3",
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 573, in run
        self.run_command('build')
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 147, in run
        check_minimum_libvirt_version()
      File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 40, in check_minimum_libvirt_version
        spawn([get_pkgcfg(),
      File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 36, in get_pkgcfg
        raise Exception("pkg-config binary is required to compile libvirt-python")
    Exception: pkg-config binary is required to compile libvirt-python

    ----------------------------------------
Command "/Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-record-4drvGZ/install-record.txt --single-version-externally-managed --compile --install-headers /Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/include/site/python2.7/libvirt-python" failed with error code 1 in /private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/
You are using pip version 18.0, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I'm using Python 2.7.10

0

The exception error message shows the problem

Exception: pkg-config binary is required to compile libvirt-python

The libvirt-python module is a binding to the libvirt C library API. In order to compile the C code associated with libvirt-python, it needs to find the libvirt library and include files. For this purpose it uses the pkg-config tool which is a widely used standard for locating libraries. You don't appear to have pkg-config installed on your host, so you need to install this. You can probably get it for OS-X from homebrew - libvirt itself should be available from there too, if you've not already got it.

  • It is already there. I installed it using homebrew – Alan Cooper Jan 19 at 4:38
  • What is already there ? libvirt or pkg-config, or both ? Assuming both are already installed from homebrew, then it could be that your $PATH does not contain the directory where homebrew installed the pkg-config binary. – DanielB Jan 22 at 11:01
  • pkg-config is already there. I will check $PATH and add the required directory if needed. Thanks for your help. – Alan Cooper Jan 22 at 18:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.