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


Groups > comp.lang.python > #197391

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 Mon, 14 Apr 2025 09:55:09 -0400
Lines 74
Message-ID <mailman.3.1744659206.3008.python-list@python.org> (permalink)
References <CAApdmf2J69WgkR159sBSkxN0=mYoNmHZYboBmpPi+LdA-YBNpg@mail.gmail.com> <020e0ef5-3d53-4f9c-acb5-842a1a971b10@tompassin.net> <CAApdmf0+91Br19ZTa5sh0CLywWhD6wyL5Ou9118cF8D==edJBg@mail.gmail.com> <45c52b56-eb57-4d54-9f91-bee30280d16f@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 +rGI6owobjxVigXWfyhKUgqq4IA9rITRZ8CI0nQyP+Ug==
Cancel-Lock sha1:NUwzDZaW9GkE/kq+UKrSe/TPozc= sha256:WpD3Vig5YlUGaWZiFoAnExxEaNXJWkaf8HQLoL3q7CQ=
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=OiaUCbay; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'pip': 0.04; 'sun,': 0.07; 'up?': 0.07; 'environment,': 0.09; 'environments': 0.09; 'group?': 0.09; 'linux': 0.09; 'pip.': 0.09; 'prints': 0.09; 'terminal': 0.09; '2025': 0.16; 'applies': 0.16; 'command.': 0.16; 'compiled': 0.16; 'directories': 0.16; 'directory.': 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; 'root.': 0.16; 'script,': 0.16; 'something.': 0.16; 'specify': 0.16; 'wrote:': 0.16; 'python': 0.16; 'instead': 0.17; 'installing': 0.19; 'pm,': 0.19; 'to:addr :python-list': 0.20; 'doubt': 0.22; 'ran': 0.22; 'version': 0.23; 'install': 0.23; 'command': 0.23; 'installed': 0.23; 'run': 0.23; 'code': 0.23; 'to:name:python-list@python.org': 0.24; 'actual': 0.25; 'seems': 0.26; 'behavior': 0.26; 'binary': 0.26; 'example,': 0.28; 'environment': 0.29; 'header:User-Agent:1': 0.30; 'packages': 0.31; 'am,': 0.31; "doesn't": 0.32; '13,': 0.32; 'gotten': 0.32; 'python-list': 0.32; 'received:10.0': 0.32; 'received:mailchannels.net': 0.32; 'received:relay.mailchannels.net': 0.32; 'secondary': 0.32; 'but': 0.32; 'mark': 0.32; "i'm": 0.33; 'header:In-Reply-To:1': 0.34; 'same': 0.34; "didn't": 0.34; 'package': 0.34; 'running': 0.35; 'runs': 0.35; 'source': 0.36; 'using': 0.37; 'could': 0.37; 'directory': 0.37; 'though': 0.37; 'put': 0.38; 'use': 0.39; "that's": 0.39; 'changes': 0.39; 'prompt': 0.39; 'received:100': 0.39; 'something': 0.40; 'want': 0.40; 'send': 0.62; 'me.': 0.64; 'your': 0.64; 'in.': 0.64; 'named': 0.65; 'back': 0.66; 'header:Received:6': 0.67; 'received:64': 0.68; 'owned': 0.69; 'you.': 0.70; 'instead,': 0.70; 'rules': 0.70; 'virtual': 0.71; 'skip:* 10': 0.73; 'successful': 0.78; 'activation': 0.84; 'activate': 0.91; 'fall': 0.95
X-Sender-Id dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal i=1; s=arc-2022; d=mailchannels.net; t=1744638911; a=rsa-sha256; cv=none; b=BCG1rr/P1RLiPWeuky5PMHJYydxhO1x/qSTQZtuqf2zPxDCQyeumoxvDZXFFxNAx96IcfZ /I4meaBaTTevUokjtatOMjVWmfrA6nMjnmEr3CN/WFDTJ70krCBsRh02K+CmnL/8XVfqih +71UHPELzeHDQk2Z1R3H/u+pSu92MyK9Q1psgUo4fQSd39KHjJqpHUBTfOtV81SqLaMh/c YGQ3tvwJjoIuYnbdcLcP20buzF5xdrBRJFJykKiYefx+WnNdIIhuXq1U2QQ4M0XjnlTfxf jrsT8fk7oGHYd9llLCW7BHesIHRLd4FFatg2oP4f5RYZN0NF4mew/Lwk4TIixA==
ARC-Message-Signature i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1744638911; 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=4kzIZ2/jXTLpiHAX9S2aixu61WDkNHKaFR8lnlYzAPU=; b=EZ82APBSP2Yferrt7bC4Jh5OwHxE6gtjsxht5MvBcF9wa3Bfd2CrGCIQmwJcrZOtMtR3Yv GwAw4SZ4Y90lmzwmRSftQm/fwH62Cq6KsPgMXR8BaOeQC5r5AcUoRArS4R6/ZclD2FDjoe e0GBbOZxPrkJsEI1pNDpEejZZHAlnFf6r7KHFsjgsGVazOiTxmB7nEVL/bTD0h1jNlOdE1 NkpqQPj1KS7EWHN1hfxjYCE4/066Q6q5CCMAgoaZq38Se3t6Z/Sd5uEuf3gYQfSb3dspoc OvngbqTBnvzxoJqnztwCCfvMkVDL3enBoD1TlIqtJ6HS5O1eZni+WKiH6JEf9Q==
ARC-Authentication-Results i=1; rspamd-865c984fb5-nbtrp; 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-Chemical-Towering 5dce59df2969fd8d_1744638911427_3892807481
X-MC-Loop-Signature 1744638911426:2649314574
X-MC-Ingress-Time 1744638911426
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net; s=dreamhost; t=1744638911; bh=4kzIZ2/jXTLpiHAX9S2aixu61WDkNHKaFR8lnlYzAPU=; h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding; b=OiaUCbaywYjkyGnJfOjSEhQ3Zklzb95QzDBpUB4TpJKU7ua3B9Fu3u5kJOIxPyqxe +1DHMA7g5JgHxew6BBZ3Lt/4bqV76xgUjdgMBkWkvwHkcn1pl98iK0xKFzRyz4Wb/+ SrpT/ds4ryq5MCyJKOlBFYh0WbCVejMkjhuoSU/GDQE8XQI3cjD4XLfzUMY94Hl6uj sFN8u9lnq91ygex/vdRE+RstY3wI/OzM+4H4fku3GtQkYEsEs8Uw5O8+DnYTsCPB1M SwcTSVDUnbLeXmdEwvjfVKPtgZl2hkwV3lIMdcrvRtjqX0eh2nAaLvuWMKMH4wgs0d 6MiqsRYfxFXvw==
User-Agent Mozilla Thunderbird
Content-Language en-US
In-Reply-To <CAApdmf0+91Br19ZTa5sh0CLywWhD6wyL5Ou9118cF8D==edJBg@mail.gmail.com>
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 <45c52b56-eb57-4d54-9f91-bee30280d16f@tompassin.net>
X-Mailman-Original-References <CAApdmf2J69WgkR159sBSkxN0=mYoNmHZYboBmpPi+LdA-YBNpg@mail.gmail.com> <020e0ef5-3d53-4f9c-acb5-842a1a971b10@tompassin.net> <CAApdmf0+91Br19ZTa5sh0CLywWhD6wyL5Ou9118cF8D==edJBg@mail.gmail.com>
Xref csiph.com comp.lang.python:197391

Show key headers only | View raw


Please include the group in your response; don't just send it to me.

On 4/14/2025 5:09 AM, Jonathan Gossage wrote:
> The virtual environment was owned by the user running pip. It was not 
> owned by root. Does pip not support virtual environments that are owned 
> by a non-root user and have a multi-user secondary group? The actual 
> command was *pip install mypy flake8 sphinx*. The other packages were 
> also installed into the user .local tree and work properly for the user 
> doing the installation, but not for other members of the group that have 
> access to the virtual environment.

Pip doesn't know about the environment it runs in. It seems to me that 
you didn't active the venv before you installed using pip. So nothing 
would have gotten installed into the venv. So where is the venv that you 
set up? I usually put them into ~/venv. For example, a venv named "gf4" 
is at ~/venv/gf4.

To activate a venv, you have to source its activate script, which is in 
the venv. First you have to mark it as executable.  Then you source it -

source ~/venv/gf4/bin/activate

Now when you run python (or more likely, python3), it will find the 
venv's directories before it will find the system's or user's. You know 
the activation has been successful because the prompt changes to show 
you.  The activation applies to the terminal session in which you 
activated the venv.

> On Sun, Apr 13, 2025 at 10:11 PM Thomas Passin <list1@tompassin.net 
> <mailto:list1@tompassin.net>> wrote:
> 
>     On 4/13/2025 7:10 PM, Jonathan Gossage via Python-list wrote:
>      > I am using *Python 3.13* in a virtual environment under *Ubuntu
>     Linux 24.04*
>      > .
>      > The version of Python was compiled from source code and installed
>     with make
>      > altinstall. I attempted to use *pip* to install the *Sphinx*
>     package into
>      > the virtual environment using the command *pip install sphinx* in the
>      > virtual environment*.* I expected that *sphinx* would be
>     installed in the
>      > *site-packages* directory in the virtual environment. Instead, it was
>      > installed into the site-packages directory in
>      > */home/jonathan/.locals/lib/python3.13/site-packages* even though
>     I did not
>      > specify *--user* to the *pip install* command. Is this expected
>     behavior? I
>      > wanted Sphinx to be installed in the virtual environment so that
>     it would
>      > be accessible to all users of the virtual environment.
> 
>     If you ran the command as a user, then pip would not have root
>     privileges and could not install into the system directory. It would
>     fall back to installing into the user's tree. It usually prints a
>     message to that effect. That's standard behavior if you don't have the
>     venv activated.
> 
>     If you want to install something into a virtual environment, you
>     have to
>     activate the environment before installing the something.
> 
>     A complication could occur if the system's Python version is the
>     same as
>     the one you built. You might inadvertently run the system's binary of
>     python 3.13 instead of your own. I'm not familiar with the make
>     altinstall command but I doubt that it changes the ordinary rules for
>     invoking python and using a venv.
> 
> 
> 
> -- 
> Jonathan Gossage

Back to comp.lang.python | Previous | NextNext in thread | Find similar


Thread

Re: Pip installs to unexpected place Thomas Passin <list1@tompassin.net> - 2025-04-14 09:55 -0400
  Re: Pip installs to unexpected place rbowman <bowman@montana.com> - 2025-04-14 21:56 +0000
    Re: Pip installs to unexpected place Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-04-14 15:31 -0700
  Re: Pip installs to unexpected place Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-04-14 15:20 -0700
    Re: Pip installs to unexpected place rbowman <bowman@montana.com> - 2025-04-15 01:12 +0000
    Re: Pip installs to unexpected place Thomas Passin <list1@tompassin.net> - 2025-04-14 23:11 -0400
    Re: Pip installs to unexpected place Thomas Passin <list1@tompassin.net> - 2025-04-14 21:51 -0400

csiph-web