libvirt-python
The libvirt virtualization API python binding
What it is and what it does
libvirt-python is a Python module that wraps the libvirt C library, exposing its virtualization management API to Python applications. It allows you to programmatically control virtual machines, containers, and other virtualization resources managed by libvirt on Linux and other operating systems. The bindings cover the main libvirt API as well as QEMU and LXC-specific extensions.
The package requires a working libvirt installation and development headers on your system, plus standard build tools (GCC, pkg-config) to compile. It supports Python 3.6 and later, is actively maintained, and carries no known security vulnerabilities. The LGPL-v2.0-or-later license permits commercial use but requires source disclosure for modifications.
Use it for:
- Automate VM lifecycle management (create, start, stop, destroy) on KVM/QEMU hypervisors from Python scripts
- Monitor and query running virtual machines and containers (LXC) to retrieve resource usage and status
- Build cloud orchestration or infrastructure-as-code tools that need to control libvirt-managed virtualization
- Integrate VM provisioning into Python-based deployment or testing frameworks
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Python bindings to the libvirt virtualization API, allowing Python applications to manage virtual machines and containers on Linux and other operating systems.
Yes, if you need to manage libvirt-controlled VMs or containers from Python and your system already has libvirt installed. The high install friction (compiled dependency) is a real barrier—verify that your platform has prebuilt wheels or that you can satisfy the build requirements before attempting installation. For systems without libvirt or build tools, the installation will fail.
Install
libvirt-python on PyPI
pip
pip install libvirt-pythonuv
uv add libvirt-pythonpoetry
poetry add libvirt-pythonInstalling libvirt-python
Before you install
High install friction: requires GCC, pkg-config, and libvirt development headers to compile from source. The package is actively maintained (released 11 days ago) and classified as Production/Stable, but the compiled dependency barrier means installation success depends on your system's build toolchain and libvirt libraries being present.
License in practice
Licensed under LGPL-v2.0-or-later (copyleft). You may use and modify this package freely, but any derivative work must also be distributed under LGPL or a compatible license, and source code must be made available to recipients.
Quickstart
# Install (requires libvirt dev headers and build tools)
pip install libvirt-python
# Basic usage
import libvirt
conn = libvirt.open('qemu:///system')
doms = conn.listAllDomains()
conn.close()
Requires GCC, pkg-config, and libvirt development headers (libvirt-devel or libvirt-dev) installed on your system before pip install will succeed.
Verify before relying
- Whether prebuilt wheels are available for common platforms to avoid compilation
- Specific libvirt version compatibility beyond the stated minimum of 0.9.11
- Performance characteristics or scalability limits for large-scale VM management
Package facts
| License | LGPL-v2.0-or-later (copyleft) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | actively maintained — 11 days since the last release |
| First released | |
| Downloads | 323,552/month — #7,604 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: libvirt_python-12.6.0.tar.gz
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
kclikcli is a command-line provisioning and…
unclear · top 15,000 on PyPI
pyobjc-framework-VirtualizationProvides Python bindings to macOS's…
permissive · top 15,000 on PyPI
azure-mgmt-desktopvirtualizationManages Azure Desktop Virtualization resources…
permissive · top 15,000 on PyPI
qemu.qmpA Python asyncio library for sending QMP (QEMU…
copyleft · top 15,000 on PyPI
cotCOT edits and deploys Open Virtualization…
permissive · top 15,000 on PyPI
python-rrmngmntManages remote Linux machines and services over…
copyleft · top 15,000 on PyPI
docker-pyA Python client library that lets you control…
permissive · top 5,000 on PyPI
dissect.hypervisorParses hypervisor disk, backup, and…
agpl · top 15,000 on PyPI
systemd-pythonProvides Python bindings to systemd's native C…
copyleft · top 5,000 on PyPI
rpmProvides access to system RPM Python bindings…
permissive · top 15,000 on PyPI