[From nobody Fri Aug  7 07:35:06 2026
Received: (at submit) by bugs.debian.org; 24 Sep 2025 02:45:47 +0000
X-Spam-Checker-Version: SpamAssassin 4.0.1-bugs.debian.org_2005_01_02
 (2024-03-25) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-17.8 required=4.0 tests=BAYES_00,
 BODY_INCLUDES_PACKAGE,FOURLA,HAS_PACKAGE,KHOP_HELO_FCRDNS,
 SPF_HELO_NONE,SPF_SOFTFAIL,XMAILER_REPORTBUG autolearn=ham
 autolearn_force=no version=4.0.1-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 80; hammy, 150; neutral, 218; spammy,
 0. spammytokens: hammytokens:0.000-+--XDebbugsCc,
 0.000-+--X-Debbugs-Cc, 0.000-+--python3, 0.000-+--stable-security,
 0.000-+--stablesecurity
Return-path: &lt;john@killTERM.com&gt;
Received: from
 216-80-103-29.s61.nwb-bsr1.chi-nwb.il.static.cable.rcncustomer.com
 ([216.80.103.29]:49770 helo=flyer.afterthought.arpa)
 by buxtehude.debian.org with esmtp (Exim 4.96)
 (envelope-from &lt;john@killTERM.com&gt;) id 1v1FVq-006PBw-1C
 for submit@bugs.debian.org; Wed, 24 Sep 2025 02:45:47 +0000
Content-Type: multipart/mixed; boundary=&quot;===============1485151181652292050==&quot;
MIME-Version: 1.0
From: John Pierce &lt;john@killTERM.com&gt;
To: Debian Bug Tracking System &lt;submit@bugs.debian.org&gt;
Subject: virt-manager scripts use #!/usr/bin/env python shebang
Message-ID: &lt;175868194386.2091350.14377792172788617720.reportbug@flyer.afterthought.arpa&gt;
X-Mailer: reportbug 13.2.0
Date: Tue, 23 Sep 2025 21:45:43 -0500
Delivered-To: submit@bugs.debian.org

This is a multi-part MIME message sent by reportbug.


--===============1485151181652292050==
Content-Type: text/plain; charset=&quot;us-ascii&quot;
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: virt-manager
Version: 1:5.0.0-5
Severity: normal
Tags: patch
X-Debbugs-Cc: john@killTERM.com


I'm testing Ansible collections with a Molecule scenario that creates
libvirt managed KVM VMs. In order to test against the most recent
versions of Python, Ansible, Molecule, and the collection plugins I
create virtualenvs using pyenv managed Python installations.

The community.libvirt.virt_install module invokes the system
virt-install convenience script. When the pyenv / virtualenv managed
python is active, the virt-install script uses it instead of the system
python resulting in the error below.

Traceback (most recent call last):
  File &quot;/usr/bin/virt-install&quot;, line 6, in &lt;module&gt;
    from virtinst import virtinstall
  File &quot;/usr/share/virt-manager/virtinst/__init__.py&quot;, line 50, in &lt;module&gt;
    from virtinst.domain import *  # pylint: disable=wildcard-import
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/share/virt-manager/virtinst/domain/__init__.py&quot;, line 5, in &lt;module&gt;
    from .blkiotune import DomainBlkiotune
  File &quot;/usr/share/virt-manager/virtinst/domain/blkiotune.py&quot;, line 8, in &lt;module&gt;
    from ..xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
  File &quot;/usr/share/virt-manager/virtinst/xmlbuilder.py&quot;, line 16, in &lt;module&gt;
    from .xmlapi import XMLAPI
  File &quot;/usr/share/virt-manager/virtinst/xmlapi.py&quot;, line 7, in &lt;module&gt;
    import libxml2
ModuleNotFoundError: No module named 'libxml2'


The Debian Python Policy specifically recommends using the full path to
the system python for this reason.

https://www.debian.org/doc/packaging-manuals/python-policy/#interpreter-location


-- System Information:
Debian Release: 13.1
  APT prefers stable-security
  APT policy: (990, 'stable-security'), (990, 'stable'), (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.12.21-hibernate (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages virt-manager depends on:
ii  dconf-gsettings-backend [gsettings-backend]  0.40.0-5
ii  gir1.2-gtk-3.0                               3.24.49-3
ii  gir1.2-gtk-vnc-2.0                           1.5.0-1
ii  gir1.2-gtksource-4                           4.8.4-6
ii  gir1.2-libosinfo-1.0                         1.12.0-2
ii  gir1.2-libvirt-glib-1.0                      5.0.0-2+b4
ii  gir1.2-vte-2.91                              0.80.1-1
ii  python3                                      3.13.5-1
ii  python3-gi                                   3.50.0-4+b1
ii  python3-gi-cairo                             3.50.0-4+b1
ii  python3-libvirt                              11.3.0-1
ii  virt-install                                 1:5.0.0-5

Versions of packages virt-manager recommends:
ii  gir1.2-ayatanaappindicator3-0.1  0.5.94-1
ii  gir1.2-spiceclientglib-2.0       0.42-3
ii  gir1.2-spiceclientgtk-3.0        0.42-3
ii  libvirt-daemon-system            11.3.0-3

Versions of packages virt-manager suggests:
ii  gir1.2-secret-1  0.21.7-1
ii  gnome-keyring    48.0-1
pn  python3-guestfs  &lt;none&gt;
pn  ssh-askpass      &lt;none&gt;
pn  virt-viewer      &lt;none&gt;

Versions of packages virt-manager is related to:
ii  libvirt-clients  11.3.0-3
ii  libvirt-daemon   11.3.0-3
ii  libvirt0         11.3.0-3
ii  osinfo-db        0.20250606-1

-- no debconf information

--===============1485151181652292050==
Content-Type: text/plain; charset=&quot;us-ascii&quot;
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=&quot;shebang-path.patch&quot;

From: John Pierce &lt;john@killTERM.com&gt;
Date: Tue, 23 Sep 2025 20:47:24 -0500
Subject: d/patches: use system python for shebang paths

Debian Python Policy (sections 3.5.2 and 5.1) depreciate /usr/bin/env
python in favor of /usr/bin/python3 for Python 3 scripts.

This policy ensures that the included convenience scripts have their
requisite dependencies met by the system package manager. This is
necessary when a user's PATH contains a non-system python, eg. pyenv,
virtualenv, etc.
---
 scripts/make_bin_wrapper.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/make_bin_wrapper.py b/scripts/make_bin_wrapper.py
index 10de492..f5c1823 100644
--- a/scripts/make_bin_wrapper.py
+++ b/scripts/make_bin_wrapper.py
@@ -10,7 +10,7 @@ parser.add_argument(&quot;filename&quot;)
 args = parser.parse_args()
 
 print(
-    f&quot;&quot;&quot;#!/usr/bin/env python3
+    f&quot;&quot;&quot;#!/usr/bin/python3
 
 import sys
 sys.path.insert(0, &quot;{args.sharepath}&quot;)

--===============1485151181652292050==--
]