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


Groups > comp.lang.python > #197421

Re: Pip installs to unexpected place

Path csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From songbird <songbird@anthive.com>
Newsgroups comp.lang.python
Subject Re: Pip installs to unexpected place
Date Sat, 19 Apr 2025 07:49:03 -0400
Organization the little wild kingdom
Lines 54
Message-ID <f6fcdl-7r5.ln1@anthive.com> (permalink)
References <4ZcdYR5WnWznV1q@mail.python.org> <cc1c6cf5-f8b9-4528-b6b0-110499b88162@wichmann.us> <4Zd3YM00SYznVKQ@mail.python.org> <CAJQBtgmfgC5aQy_7RXwHDbsxaf1UWYY0=FNsgPPR2UzzuKfTTA@mail.gmail.com> <4ZdrJv0v0LznV1q@mail.python.org> <6d1ac10c-80c0-484b-a7e7-e1966cea1b5d@wichmann.us> <mailman.19.1744926071.3008.python-list@python.org> <m6dnueFg8f0U1@mid.individual.net> <20250418153848.w2hmxpegl3uwii3w@hjp.at> <e1cce2f7-e59b-42bb-95ee-602f241f545b@tompassin.net> <20250419085614.vbgzh7h7hggyhzsd@hjp.at> <mailman.24.1745052976.3008.python-list@python.org>
Reply-To songbird <songbird@anthive.com>
Injection-Date Sat, 19 Apr 2025 13:49:38 +0200 (CEST)
Injection-Info dont-email.me; posting-host="4dfdbf682a75255887e56e2cd96b79ab"; logging-data="1452157"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Pdzy+co28SiE83gbfq9AYDjdrJp3ZFro="
User-Agent slrn/1.0.3 (Linux)
Cancel-Lock sha1:GFthJ/71QbsGoVdkRjpWw6xf81U=
Xref csiph.com comp.lang.python:197421

Show key headers only | View raw


Peter J. Holzer wrote:
> On 2025-04-18 13:08:36 -0400, Thomas Passin via Python-list wrote:
...
>> When the system launches its application the PYTHONPATH will start with
>> system site directories; local user site directories will be on the
>> PYTHONPATH but since they come later, the python will use PyQt6 v6.8.3
>> because that will come first on the path.  No crash here.
>> 
>> If the user has a program that actually does require the use of v6.9.0, he's
>> going to have to make sure that the user's local site directories come first
>> on the path. One way to do that is to set the PYTHONPATH to point to the
>> user's location.
>
> This is IMHO not practical. The user would have to set PYTHONPATH for
> some programs, but not for others. You can't do this with .bashrc (or
> similar), the user would have to write a wrapper script for each of
> their programs which depend on something in ~/.local. Possible of course
> but cumbersome.

  currently in my .bashrc i have it set up to look for which
directory the terminal is in and then runs the activate script
for that environment.  i like to keep my desktops/projects
open with various numbers of terminals available so this way
they are all ready to go when the system boots up.


> I like Oscar's suggestion that Python scripts provided by the
> distribution include -s in the shebang much better.
>
> Or - what I tend to do - simply use a virtual environment for each
> script that needs a package that the system doesn't provide. But of
> course that's basically "disable/don't use .local" and all those venvs
> take space and need to be maintained.

  i like that they do not change until i specificly ask them to
be changed.


...
>> The only one I can think of is for the user, with the help of sudo, or
>> by editing some system-enabled script, were to change the global
>> PYTHONPATH.  That seems a stretch.
>
> No, there doesn't have to be a global (in the sense that it applies to
> all users) PYTHONPATH for that to happen. You just need a PYTHONPATH
> that is set for all processes of that user - which the user can
> certainly set without sudo (usually by editing .bashrc or maybe using
> their desktop environment's settings dialog).

  yes, that is part of what .bashrc is for, making sure your
environment variables are set how you'd like them.


  songbird

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


Thread

Re: Pip installs to unexpected place Mats Wichmann <mats@wichmann.us> - 2025-04-17 15:41 -0600
  Re: Pip installs to unexpected place Greg Ewing <greg.ewing@canterbury.ac.nz> - 2025-04-18 13:24 +1200
    Re: Pip installs to unexpected place (Posting On Python-List Prohibited) Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-04-18 02:20 +0000
    Re: Pip installs to unexpected place "Peter J. Holzer" <hjp-python@hjp.at> - 2025-04-18 17:38 +0200
    Re: Pip installs to unexpected place Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2025-04-18 17:11 +0100
    Re: Pip installs to unexpected place Thomas Passin <list1@tompassin.net> - 2025-04-18 13:08 -0400
    Re: Pip installs to unexpected place "Peter J. Holzer" <hjp-python@hjp.at> - 2025-04-19 10:38 +0200
    Re: Pip installs to unexpected place "Peter J. Holzer" <hjp-python@hjp.at> - 2025-04-19 10:56 +0200
      Re: Pip installs to unexpected place songbird <songbird@anthive.com> - 2025-04-19 07:49 -0400
    Re: Pip installs to unexpected place Thomas Passin <list1@tompassin.net> - 2025-04-19 15:56 -0400
      Re: Pip installs to unexpected place rbowman <bowman@montana.com> - 2025-04-20 04:34 +0000

csiph-web