libvirt / libvirt-python Goto Github PK
View Code? Open in Web Editor NEWRead-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-python
License: GNU Lesser General Public License v2.1
Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-python
License: GNU Lesser General Public License v2.1
Libvirt Python Binding README ============================= This package provides a module that permits applications written in the Python 3.x programming language to call the interface supplied by the libvirt library, to manage the virtualization capabilities of recent versions of Linux (and other OSes). As such, the module exposes Python bindings to to the libvirt.so, libvirt-qemu.so and libvirt-lxc.so library APIs. It is written to build against any version of libvirt that is 0.9.11 or newer. This code is distributed under the terms of the LGPL version 2 or later. Requirements ------------ To build the libvirt python binary requires the GCC and pkg-config tools, and development headers for the libvirt and python libraries. Building and installing ----------------------- The module can be built by following the normal python module build process $ python3 -m build for testing and distributing purposes or it can be installed directly via pip as $ python3 -m pip install . without explicit building. In order to test the package, you'll need either tox or at least pytest, depending on whether you want to test an already installed package in which case the latter is sufficient or if you wish to test in a virtual environment you'd need tox. Depending on your preferred setup, you can run the tests either as $ python3 -m pytest or as $ tox A makefile shim is also provided for your convenience, so that you don't have to care about the exact operations mentioned above and instead you simply do $ make && make check As of libvirt 1.2.6, it is possible to develop against an uninstalled libvirt.git checkout, by setting PKG_CONFIG_PATH and LD_LIBRARY_PATH environment variables to point into that libvirt tree; you can even automate this by using libvirt's run script: /path/to/libvirt/run python3 -m build Patches for this code should be submitted as merge requests to the project page on gitlab. See CONTRIBUTING.rst for more information.
Building wheel for libvirt-python (pyproject.toml) ... error
error: subprocess-exited-with-error
Building wheel for libvirt-python (pyproject.toml) did not run successfully.
exit code: 1
[59 lines of output]
running bdist_wheel
running build
running build_py
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
No package 'libvirt' found
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
main()
File "/usr/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 249, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 434, in build_wheel
return self._build_with_temp_dir(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 419, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup
exec(code, locals())
File "<string>", line 284, in <module>
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 107, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1233, in run_command
super().run_command(command)
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/tmp/pip-build-env-l41c65p4/normal/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 349, in run
self.run_command("build")
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1233, in run_command
super().run_command(command)
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run
self.run_command(cmd_name)
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1233, in run_command
super().run_command(command)
File "/tmp/pip-build-env-l41c65p4/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "<string>", line 166, in run
File "<string>", line 35, in check_minimum_libvirt_version
File "/usr/lib64/python3.11/subprocess.py", line 413, 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.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for libvirt-python
Failed to build libvirt-python
ERROR: Could not build wheels for libvirt-python, which is required to install pyproject.toml-based projects
Hi, im running since a few hours into the following issue:
client: MacOS Big Sur: Python3 + python-libvirt / virsh also installed
if im trying to connect to a remote hypervisor i get the following error message
virsh -c qemu+ssh://root@Public_IP/system list --all
libvirtd is listening, i have absolutly no clue whats the issue, any idea ?
error: failed to connect to the hypervisor
error: End of file while reading data: nc: unix connect failed: No such file or directory: Input/output error
Hello,
I use a distibution ALMALINUX 9.1 and I have an error when i want to install libvirt-python :
sudo python3.9 -m pip --trusted-host pypi.org --trusted-host files.pythonhosted.org install libvirt-python
Collecting libvirt-python
Using cached libvirt-python-8.10.0.tar.gz (240 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: libvirt-python
Building wheel for libvirt-python (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
running bdist_wheel
running build
running build_py
creating build/lib.linux-x86_64-3.9
copying build/libvirt.py -> build/lib.linux-x86_64-3.9
copying build/libvirt_qemu.py -> build/lib.linux-x86_64-3.9
copying build/libvirt_lxc.py -> build/lib.linux-x86_64-3.9
copying build/libvirtaio.py -> build/lib.linux-x86_64-3.9
running build_ext
Generated 280 wrapper functions
Generated 1 wrapper functions
Generated 1 wrapper functions
building 'libvirtmod' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/build
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -DOPENSSL_LOAD_CONF -fwrapv -fno-semantic-interposition -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -IVendor/ -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -IVendor/ -fPIC -I. -I/usr/include/python3.9 -c build/libvirt.c -o build/temp.linux-x86_64-3.9/build/libvirt.o
build/libvirt.c:3:10: fatal error: Python.h: Aucun fichier ou dossier de ce type
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: 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
error: subprocess-exited-with-error
× Running setup.py install for libvirt-python did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
running install
running build
running build_py
creating build/lib.linux-x86_64-3.9
copying build/libvirt.py -> build/lib.linux-x86_64-3.9
copying build/libvirt_qemu.py -> build/lib.linux-x86_64-3.9
copying build/libvirt_lxc.py -> build/lib.linux-x86_64-3.9
copying build/libvirtaio.py -> build/lib.linux-x86_64-3.9
running build_ext
Generated 280 wrapper functions
Generated 1 wrapper functions
Generated 1 wrapper functions
building 'libvirtmod' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/build
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -DOPENSSL_LOAD_CONF -fwrapv -fno-semantic-interposition -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -IVendor/ -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -IVendor/ -fPIC -I. -I/usr/include/python3.9 -c build/libvirt.c -o build/temp.linux-x86_64-3.9/build/libvirt.o
build/libvirt.c:3:10: fatal error: Python.h: Aucun fichier ou dossier de ce type
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> libvirt-python
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
How to solve this ?
Thanks
$ pip install libvirt-python
Collecting libvirt-python
Using cached libvirt-python-8.7.0.tar.gz (236 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
pkg-config binary is required to compile libvirt-python
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
The examples readme says: "The XML files in this directory are examples of the XML format that libvirt expects, and will have to be adapted for your setup." The XML file is missing from the directory
I try to auto run cmds by console, but I found that i cant get a console handler after I call this func.
I can't close these console and they cause fd leaks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.