How to compile virt-manager on Debian or Ubuntu

Question: I want to build and install the latest virt-manager from its source on my Linux desktop. What is the procedure for compiling virt-manager on [Debian, Ubuntu]?

virt-manager is a GUI-based virtual machine manager which allows you to create and manage (local or remote) virtual machines and containers via libvirt APIs. It supports multiple hypervisors such as KVM, QEMU, Xen, as well as LXC containers. While virt-manager is available in most distros' base repositories, the pre-built virt-manager package always falls behind the latest releases available from the official website. For example, Ubuntu 15.10 and Debian 8 come with virt-manager 1.1, while the latest virt-manager is version 1.3.2.

If you want to try the latest and greatest features of virt-manager, you need to build and install it from the source. In this post, I show how to compile virt-manager on Debian, Ubuntu or Linux Mint. If you want to build virt-manager on Red Hat based distribution, refer to this tutorial instead.

Before you start, you need to uninstall the existing virt-manager if you have already installed it from your distro's repositories.

$ sudo apt-get remove virt-manager

Next, set up the build environment for virt-manager and install any necessary prerequisites.

$ sudo apt-get build-dep virt-manager
$ sudo apt-get install python-libvirt libgtk-3-dev libvirt-glib-1.0 gir1.2-gtk-vnc-2.0 gir1.2-spice-client-gtk-3.0 libosinfo-1.0 python-ipaddr gir1.2-vte-2.90 python-libxml2 python-requests

Finally, download the latest source and install it as follows.

$ wget
$ tar -xf virt-manager-1.3.2.tar.gz
$ cd virt-manager-1.3.2
$ sudo python install

To launch virt-manager from the command line:

$ virt-manager

Troubleshooting Tips

Here are solutions to various errors that you may encounter while building virt-manager from the source on a Debian-based distro.

1. ImportError: No module named libvirt

$ sudo apt-get install python-libvirt

2. ImportError: No module named libxml2

$ sudo apt-get install python-libxml2

3. ImportError: No module named requests

$ sudo apt-get install python-requests

4. Error launching details: Namespace GtkVnc not available

$ sudo apt-get install gir1.2-gtk-vnc-2.0

5. Error launching details: Namespace SpiceClientGtk not available

$ sudo apt-get install gir1.2-spice-client-gtk-3.0

6. ValueError: Namespace LibvirtGLib not available

$ sudo apt-get install libvirt-glib-1.0

7. ValueError: Namespace Libosinfo not available

$ sudo apt-get install libosinfo-1.0

8. ImportError: No module named ipaddr

$ sudo apt-get install python-ipaddr

9. Namespace Gtk not available: Could not open display: localhost:10.0

$ sudo apt-get install libgtk-3-dev

10. ImportError: cannot import name Vte

$ sudo apt-get install gir1.2-vte-2.90
Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

3 thoughts on “How to compile virt-manager on Debian or Ubuntu

Leave a comment

Your email address will not be published. Required fields are marked *