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


Groups > comp.lang.python > #197410

Re: Pip installs to unexpected place

Path csiph.com!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 Thu, 17 Apr 2025 08:24:31 -0400
Lines 43
Message-ID <mailman.16.1744892689.3008.python-list@python.org> (permalink)
References <CAApdmf2J69WgkR159sBSkxN0=mYoNmHZYboBmpPi+LdA-YBNpg@mail.gmail.com> <CAN06=CxPNLHtr_sdgphR2jrN1V+WbB8wZDJdbvfEDb-MYtmPHA@mail.gmail.com> <818a0fcd-72c8-4fbb-8ee4-4553f4f88f75@wichmann.us> <d9dd903b-856c-470d-b7ce-1f4ad8b49adc@roelschroeven.net> <92fc130a-7d71-4a38-aab6-881e2610fdb7@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 Jd08h7TjBsJiN5kbQulXegqBDAd2tU5FUM21oMa9zLbA==
Cancel-Lock sha1:SraD2/1DGXn0BTYnavZaF16JIQQ= sha256:dYwkn5vQ/Mu8YycLVnjV+MQHRMcQMHp4A+Ntll7Y5f0=
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=yeABgFXN; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'pip': 0.04; 'used.': 0.07; 'bin': 0.09; 'pip.': 0.09; 'roel': 0.09; 'schroeven': 0.09; 'executable': 0.16; 'mats': 0.16; 'packages,': 0.16; 'pip,': 0.16; 'python3': 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; 'schreef': 0.16; 'virtualenv': 0.16; 'wichmann': 0.16; 'wrote:': 0.16; 'python': 0.16; "can't": 0.17; 'to:addr:python-list': 0.20; 'install': 0.23; 'command': 0.23; 'installed': 0.23; 'run': 0.23; '(and': 0.25; 'saying': 0.25; 'behavior': 0.26; 'visual': 0.26; 'settings': 0.28; 'example,': 0.28; 'environment': 0.29; 'it,': 0.29; 'header:User- Agent:1': 0.30; 'am,': 0.31; 'python-list': 0.32; 'received:10.0': 0.32; 'received:mailchannels.net': 0.32; 'received:relay.mailchannels.net': 0.32; 'path': 0.33; 'header:In- Reply-To:1': 0.34; 'same': 0.34; 'running': 0.35; 'those': 0.36; "it's": 0.37; 'directory': 0.37; 'way': 0.38; 'means': 0.38; 'use': 0.39; "that's": 0.39; 'changes': 0.39; 'prompt': 0.39; 'received:100': 0.39; 'something': 0.40; 'should': 0.40; 'in,': 0.60; 'including': 0.60; 'here.': 0.61; 'gives': 0.62; 'everything': 0.63; 'your': 0.64; 'named': 0.65; 'header:Received:6': 0.67; 'received:64': 0.68; 'figures': 0.69; 'latter': 0.69; 'skip:/ 30': 0.69; 'depending': 0.70; 'finds': 0.76; 'match.': 0.84; 'activate': 0.91; 'former': 0.93
X-Sender-Id dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal i=1; s=arc-2022; d=mailchannels.net; t=1744892679; a=rsa-sha256; cv=none; b=bK42o3keoLyAIYoB4LL/ll4NYfWx0Kmx2dOtkTK27pTszM6rfkWx62OUSpmm1cAbNrdUIp rY22U0aNg7iWZrDh27PhBCk0Yk8j5vpNp7Urz/N40m6wDW9Q7leuUmmkT2RvXEPpX/FP5C JGDl+zEsqdhEiUjqubI9OXKXcxoXfCbpnEiuVlJfSzjUq37n311sBldCwD89siJZneDR6k 9WM4/ItFnfKU1FYyXDeUYNZFV9Jn3kh2Z9bIG9jBWxKy8gkjzjBtKputGiNh7fUXrCcS7O /qU69wjeGMNYooQlkY9uQkvn1Vp174MvqQ+HWesSS2sSxIgG6NIrRDenCdpDjg==
ARC-Message-Signature i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1744892679; 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=7m31xH5lCQf+r+ISK8eSGtgQR3Es45seB/GZGnuS1m4=; b=VKwYhBjerxvXvglC8SgF+gz5frAYp4klAHDR/F4rWQa+zQSXaveZOmGTWYQOfBPkzWwOEF tbeUruRAgpqCdYNmUc09VNIaNwMy1E+NTpRfk2+yKWFaZQERoT+3RADRwmy6NK9pYtqjvf 7BAsHgAmLceiDw8F6u9GHq8fId/o89FO7sZYX9NoyLUCHuJCizJRe76lqm04WN7FYPMFJo qQYUdcjnTluQ0LbKD0X5MbMot1GhpFwOpLibhMtfQwrE0gcbl/0tjcJtuEj28QxBqH+sZh t2lKoEwcGEFY9F2Ndmp+9jrv+mLga48gsePXlIPicOX+nx+UUoOAjApdV/Y0jA==
ARC-Authentication-Results i=1; rspamd-66f96cc86b-8bmm5; 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-Wide-Eyed-Shelf 6ebe225e232c827f_1744892679448_3056278233
X-MC-Loop-Signature 1744892679448:2158881121
X-MC-Ingress-Time 1744892679448
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net; s=dreamhost; t=1744892678; bh=7m31xH5lCQf+r+ISK8eSGtgQR3Es45seB/GZGnuS1m4=; h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding; b=yeABgFXN/mZnzT84L8pn3uCQuYcbn6zyhjgv3A0PLBk0Uru02XkqWWtnxpLnB02XE lrHoNcHUrWcbJ4h9FILpsCCYKNS2xf8tap5R2I5FhVEx4nd3q5x4rpvRrvtnOm0c7I tS+za2XQywRcL7kltDXgohLQb3CGmJO6viGmaNm02X9orCtQZgDbI57czl3kKgSZbm 3BgrpE9NpQEfdAIWPJ6HfUKZETGQ6509zpJwOmqisIRlqGcBLWPoleP6PRA7jktUEJ quYl3viwHcpnsXaKI1zCPKgwUPphASvB678TY5suKBo8klqjyLd8KIkK+fCoR1ypm4 kaBlz3C5kmwTQ==
User-Agent Mozilla Thunderbird
Content-Language en-US
In-Reply-To <d9dd903b-856c-470d-b7ce-1f4ad8b49adc@roelschroeven.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 <92fc130a-7d71-4a38-aab6-881e2610fdb7@tompassin.net>
X-Mailman-Original-References <CAApdmf2J69WgkR159sBSkxN0=mYoNmHZYboBmpPi+LdA-YBNpg@mail.gmail.com> <CAN06=CxPNLHtr_sdgphR2jrN1V+WbB8wZDJdbvfEDb-MYtmPHA@mail.gmail.com> <818a0fcd-72c8-4fbb-8ee4-4553f4f88f75@wichmann.us> <d9dd903b-856c-470d-b7ce-1f4ad8b49adc@roelschroeven.net>
Xref csiph.com comp.lang.python:197410

Show key headers only | View raw


On 4/17/2025 4:58 AM, Roel Schroeven via Python-list wrote:
> Op 15/04/2025 om 20:31 schreef Mats Wichmann via Python-list:
>> To be clear: you do not have to activate a virtualenv to use *Python* 
>> from it. If you just call the python by the path it's in, it figures 
>> everything out (and sets some variables you can query vi sysconfig if 
>> you have reason to actually need those details (look for installation 
>> schemes).
>>
>> What activating gives you is some path fiddling, and some prompt 
>> fiddling (although the prompt fiddling keeps saying it's deprecated). 
>> The latter is a visual clue; the former means you can also find 
>> *other* commands installed in the virtualenv - including pip.
>>
>> /path/to/virtualenv//bin/python -m pip install ...   will work whether 
>> you activated or not.
>>
>> pip install ...  finds the first command in your PATH named pip, which 
>> may or may not be the one in the virtualenv, *unless* you've activated 
>> it, because that's the only way the virtualenv bin directory ends up 
>> early in your path.

Or you can cd to the venv directory and it will be first on the pythonpath.

> And the pip command that is found and run will use it's own settings 
> regarding where to install packages, even if you activated a virtualenv. 
> For example, you can't use /usr/bin/pip to install something in a 
> virtualenv.

pip detects if you are running in a venv and changes its behavior to match.

To install something in a virtualenv, you need to use the
> pip in that virtualenv (either by first activating that venv, or by 
> running something like venv/bin/pip, or venv). (Of course to do that pip 
> needs to be installed in that venv. That might or might not be the case 
> depending on how the venv was created.)
> 
> I kinda get the feeling that something like that is going on here.
> 

IMHO pip should always be run as a module, e.g., python3 -m pip. This 
way you always get the same pip and environment as the python executable 
that is being used.

Back to comp.lang.python | Previous | Next | Find similar


Thread

Re: Pip installs to unexpected place Thomas Passin <list1@tompassin.net> - 2025-04-17 08:24 -0400

csiph-web