Deutsch   English   Français   Italiano  
<mailman.14.1744823411.3008.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: Thomas Passin <list1@tompassin.net>
Newsgroups: comp.lang.python
Subject: Re: Pip installs to unexpected place
Date: Wed, 16 Apr 2025 12:50:27 -0400
Lines: 44
Message-ID: <mailman.14.1744823411.3008.python-list@python.org>
References: <CAApdmf2J69WgkR159sBSkxN0=mYoNmHZYboBmpPi+LdA-YBNpg@mail.gmail.com>
 <CAN06=CxPNLHtr_sdgphR2jrN1V+WbB8wZDJdbvfEDb-MYtmPHA@mail.gmail.com>
 <bbe32f47-13d2-459c-af22-4e0e37834091@tompassin.net>
 <mailman.9.1744749213.3008.python-list@python.org>
 <m681ukFimrnU2@mid.individual.net>
 <d9974802-78f3-403c-9e69-077494d4e940@tompassin.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 6c8Ok9USKvWkW/OPtebY3w71ZQ1TqYOwE1UDEX5mbyFg==
Cancel-Lock: sha1:RN8/x5/dPDZ82hyun6u38y0lacA= sha256:n3EVvdSZhM960yf42FJPZ7XtluSH+aCAsaUZqIyIskc=
Return-Path: <list1@tompassin.net>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
 reason="2048-bit key; unprotected key"
 header.d=tompassin.net header.i=@tompassin.net header.b=g2N3k8zF;
 dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.003
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'pip': 0.04; 'exit': 0.07;
 'linux,': 0.07; 'depend': 0.09; 'enabled': 0.09; 'fedora': 0.09;
 'insist': 0.09; 'install,': 0.09; 'installer': 0.09; 'ubuntu':
 0.09; 'user.': 0.09; '2025': 0.16; 'command-line': 0.16;
 'document,': 0.16; 'flag': 0.16; 'privileges': 0.16;
 'received:10.0.0': 0.16; 'received:64.90': 0.16;
 'received:64.90.62': 0.16; 'received:64.90.62.162': 0.16;
 'received:dreamhost.com': 0.16; 'restriction': 0.16; 'spec:':
 0.16; 'url:latest': 0.16; 'wrote:': 0.16; 'python': 0.16; 'admin':
 0.19; 'installing': 0.19; 'pm,': 0.19; 'to:addr:python-list':
 0.20; 'option': 0.20; 'version': 0.23; 'install': 0.23; 'saying':
 0.25; 'behavior': 0.26; 'configure': 0.26; 'so.': 0.26; 'bit':
 0.27; 'version.': 0.28; 'example,': 0.28; 'error': 0.29; 'header
 :User-Agent:1': 0.30; 'default': 0.31; 'tue,': 0.31; 'checks':
 0.32; 'disabled': 0.32; 'python-list': 0.32; 'received:10.0':
 0.32; 'received:mailchannels.net': 0.32;
 'received:relay.mailchannels.net': 0.32; 'specified': 0.32; 'but':
 0.32; "i'm": 0.33; 'there': 0.33; 'header:In-Reply-To:1': 0.34;
 'package': 0.34; 'running': 0.35; 'following': 0.35; 'really':
 0.36; 'built': 0.36; "it's": 0.37; 'directory': 0.37; 'file':
 0.38; 'way': 0.38; 'both': 0.38; 'use': 0.39; 'neither': 0.39;
 'received:100': 0.39; 'wants': 0.40; 'something': 0.40; 'want':
 0.40; 'should': 0.40; '8bit%:20': 0.61; 'identified': 0.62;
 'true': 0.63; 'here': 0.63; 'his': 0.65; 'url-ip:104.16/16': 0.65;
 'tool': 0.65; 'outside': 0.67; 'header:Received:6': 0.67;
 'received:64': 0.68; 'exactly': 0.68; 'conditions': 0.70; 'carry':
 0.71; 'virtual': 0.71; 'global': 0.73; '(that': 0.84; 'default:':
 0.84; 'environment?': 0.84; 'rules,': 0.84
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1744822228; a=rsa-sha256;
 cv=none;
 b=i2w2GcHrXQ+3d1SvG2QEOKoN0LBAnQYE/AFv6v9N2gFB2ECpQe3my7dWndZk92zwhz82WX
 uZbMwGxETtmvv7I4Y5ZsKWDq/nHvGzUPHBezBUtWuisXOzM00bZ+BUYylMK2M5swrQgH8f
 1z6OT28gcqSAJHhdueYiR5OWWMrW2PmYM2w9Ufn+f0XEGN3QnuMPiCftZ1sc9a/G5hY6X8
 +nVGMMzr66j7zdgT0701h9TYJT88NZjhmDb/J406qURlHm006zeJfTFfb9ljCuXuQH79Jj
 xhEa+9WWmGNejxViYqrvoHUoOMB8HLAU4NZrqZXUQ8eih9xghlJDfKGdW2Cg4A==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
 d=mailchannels.net; s=arc-2022; t=1744822228;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references:dkim-signature;
 bh=8tPcmmVspBAUardtQpcgDWUHPtEZgzfSMxCHzyvPu78=;
 b=YKv62HB9u+FYgRZkzYy+2owzmT2kRKpfSZWL6J29j8J+mR2mbdrX/O7HaanqUk75K/BHEe
 8IToXq6jzh4XJYnWwvYDOW3tOmHdlljhVmCNPgDcAMUD47dfQHQznkdG712OySY/u01hrm
 GGgKcCOjIbp/J4+UwCRwNDDwQw4HqJbUnAQijly4oTm4iuk0ajv/pEl0nJ3TG7tsyT7wTT
 37kIcJ865S+5pljZ5A5H+3TLSzQN6USZvwS2Cosz4ebq+bHos8OT9HodS4RYzce4cx4Gu1
 Ijws4OVRZernGWgs14OpCa7us6VznCFQNA0RK1bI39YBDCa8kBMlPlcIB5QJIw==
ARC-Authentication-Results: i=1; rspamd-66f96cc86b-gblhx;
 auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net
X-MailChannels-Auth-Id: dreamhost
X-Tasty-Fumbling: 69279eec4e0c6fe3_1744822228856_2045703921
X-MC-Loop-Signature: 1744822228856:281765317
X-MC-Ingress-Time: 1744822228856
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net;
 s=dreamhost; t=1744822228;
 bh=8tPcmmVspBAUardtQpcgDWUHPtEZgzfSMxCHzyvPu78=;
 h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding;
 b=g2N3k8zF6t7ffgY3KM42rrvtW8A0oI16llYy5ivUx05DtIF2t+/NzCXGB2HgnLsvQ
 ZiJ6MQLQTy3JlMmgHt5JPwPUgrhOaiuchLuXip925VPuNQ3Sl4G8gjv1267CA1mW+7
 h3ihcvvENM+O1gr6nxRTI1BGfpB9YsyHubE5n444iESlbsZuAjokONTlBw5pQfJ3KC
 T5JHPRfILRKUhKELt4sXe1kK24NGArw78PdWz8mTrpt/aIX/u1fGM756Pi5hZtxFb5
 EYuNjgz8i2P01FPqpUaeDxJfw0LR/J0QFNUjfFVsrM9PN0jHZAj0HOXn6/zj/u6Gse
 qRFdXDRaPdNaQ==
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <m681ukFimrnU2@mid.individual.net>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
 <python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
 <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
 <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <d9974802-78f3-403c-9e69-077494d4e940@tompassin.net>
X-Mailman-Original-References: <CAApdmf2J69WgkR159sBSkxN0=mYoNmHZYboBmpPi+LdA-YBNpg@mail.gmail.com>
 <CAN06=CxPNLHtr_sdgphR2jrN1V+WbB8wZDJdbvfEDb-MYtmPHA@mail.gmail.com>
 <bbe32f47-13d2-459c-af22-4e0e37834091@tompassin.net>
 <mailman.9.1744749213.3008.python-list@python.org>
 <m681ukFimrnU2@mid.individual.net>

On 4/15/2025 5:38 PM, rbowman via Python-list wrote:
> On Tue, 15 Apr 2025 14:12:19 -0400, Thomas Passin wrote:
> 
>> On Linux, at least, it's standard for pip to install into the user's
>> site-packages location if it's not invoked with admin privileges - even
>> without --user. Pip will emit a message saying so. Well, that used to be
>> true but nowadays Pip wants you to use the --break-system-packages flag
>> if you want to insist on installing into the system's Python install,
>> even if it's going to go into --user. I'm not sure if the restriction
>> will be in place given that the OP built his own Python version.
> 
> Is that pip or a distro's version of pip? On Fedora I get the message
> about defaulting to user. On Ubuntu I get a message to use a venv or if I
> really want a global install to use something like 'pip install python3-
> black'. Ubuntu's is pip 24.2, Fedor's is 24.3.1 but neither of them show
> '--break-system-packages' in --help.

The behavior is specifed in

https://packaging.python.org/en/latest/specifications/externally-managed-environments/#externally-managed-environments

Exactly how pip works and what messages it emits are specified by this 
document, and the details depend on how the distro's packagers configure 
it.  For example, here is a bit of the spec:

"Before a Python-specific package installer (that is, a tool such as pip 
- not an external tool such as apt) installs a package into a certain 
Python context, it should make the following checks by default:

     Is it running outside of a virtual environment? It can determine 
this by whether sys.prefix == sys.base_prefix.

     Is there an EXTERNALLY-MANAGED file in the directory identified by 
sysconfig.get_path("stdlib", sysconfig.get_default_scheme())?

If both of these conditions are true, the installer should exit with an 
error message indicating that package installation into this Python 
interpreter’s directory are disabled outside of a virtual environment.

The installer should have a way for the user to override these rules, 
such as a command-line flag --break-system-packages. This option should 
not be enabled by default and should carry some connotation that its use 
is risky."