Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #14959

#!/usr/bin/python3 vs virtualenv

Path csiph.com!1.us.feeder.erje.net!3.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!fu-berlin.de!bofh.it!news.nic.it!robomod
From Marc Glisse <marc.glisse@inria.fr>
Newsgroups linux.debian.maint.python
Subject #!/usr/bin/python3 vs virtualenv
Date Fri, 03 Mar 2023 16:30:01 +0100
Message-ID <G5fw5-9OsW-3@gated-at.bofh.it> (permalink)
X-Mailbox-Line From debian-python-request@lists.debian.org Fri Mar 3 15:27:12 2023
Old-Return-Path <marc.glisse@inria.fr>
X-Amavis-Spam-Status No, score=-2.098 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FOURLA=0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001] autolearn=no autolearn_force=no
X-Policyd-Weight using cached result; rate: -5.5
Authentication-Results mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=marc.glisse@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr
X-Ironport-Av E=Sophos;i="5.98,231,1673910000"; d="scan'208";a="49160365"
MIME-Version 1.0
Content-Type text/plain; format=flowed; charset=US-ASCII
X-Mailing-List <debian-python@lists.debian.org> archive/latest/20861
List-ID <debian-python.lists.debian.org>
List-URL <https://lists.debian.org/debian-python/>
List-Archive https://lists.debian.org/msgid-search/1c48b573-b3cd-0eb8-4493-752dd9d0c3fa@inria.fr
Approved robomod@news.nic.it
Lines 38
Organization linux.* mail to news gateway
Sender robomod@news.nic.it
X-Original-Date Fri, 3 Mar 2023 16:10:50 +0100 (CET)
X-Original-Message-ID <1c48b573-b3cd-0eb8-4493-752dd9d0c3fa@inria.fr>
Xref csiph.com linux.debian.maint.python:14959

Show key headers only | View raw


Hello,

I recently reported 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1032283 , and Dmitry 
suggested discussing it on this mailing list.

Virtual environments work by adding some version of Python (possibly just 
a symlink to the system one) at the beginning of PATH. Debian policy for 
Python scripts is to use #!/usr/bin/python3 and **not** #!/usr/bin/env 
python3, so they are not affected.

I think there are 2 types of Python scripts. The first type is 
applications for end users, like hg or calibre (it is possible that the 
existence of plugins makes my choice of examples a bad one). If I have 
some strange Python virtual environment active, I am happy that the Debian 
policy prevents the virtual environment from breaking those applications 
(although I may still be able to break them with PYTHONPATH).

The second type is targeted at developers, like sphinx-build. If I 
activate a virtual environment that contains tensorflow, it is because I 
need `import tensorflow` to work inside sphinx-build, but now the Debian 
policy prevents it.

As discussed in the bug report, there are workarounds. The question here 
is whether it would make sense to amend the policy for some types of 
scripts. The answer is probably no, but it seems worth checking what 
people think.

The suggestion to install a copy of sphinx in the virtual environment is a 
step towards the advice I hear around me but don't really want to follow: 
"Developers should use conda, system python packages are only for system 
applications" :-(

(thanks a lot to everyone here working on packaging Python stuff in 
Debian)

-- 
Marc Glisse

Back to linux.debian.maint.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

#!/usr/bin/python3 vs virtualenv Marc Glisse <marc.glisse@inria.fr> - 2023-03-03 16:30 +0100
  Re: #!/usr/bin/python3 vs virtualenv Danial Behzadi دانیال بهزادی <dani.behzi@ubuntu.com> - 2023-03-03 19:50 +0100
    Re: #!/usr/bin/python3 vs virtualenv Jeremy Stanley <fungi@yuggoth.org> - 2023-03-03 20:20 +0100
      Re: #!/usr/bin/python3 vs virtualenv Jorge Moraleda <jorge.moraleda@gmail.com> - 2023-03-03 21:30 +0100
        Re: #!/usr/bin/python3 vs virtualenv Jeremy Stanley <fungi@yuggoth.org> - 2023-03-03 21:50 +0100
          Re: #!/usr/bin/python3 vs virtualenv Jorge Moraleda <jorge.moraleda@gmail.com> - 2023-03-03 22:30 +0100
            Re: #!/usr/bin/python3 vs virtualenv Jeremy Stanley <fungi@yuggoth.org> - 2023-03-03 22:50 +0100
            Re: #!/usr/bin/python3 vs virtualenv Julian Gilbey <julian@d-and-j.net> - 2023-03-05 11:50 +0100
              Re: #!/usr/bin/python3 vs virtualenv Jorge Moraleda <jorge.moraleda@gmail.com> - 2023-03-05 13:00 +0100
              Re: #!/usr/bin/python3 vs virtualenv Stefano Rivera <stefanor@debian.org> - 2023-03-09 23:40 +0100
    Re: #!/usr/bin/python3 vs virtualenv Marc Glisse <marc.glisse@inria.fr> - 2023-03-05 14:20 +0100
  Re: #!/usr/bin/python3 vs virtualenv Dmitry Shachnev <mitya57@debian.org> - 2023-03-03 21:50 +0100

csiph-web