pip/setuptools: Entry points not visible from pkexec-root-environment

Chris Angelico rosuav at gmail.com
Mon Dec 19 06:17:26 EST 2022


On Mon, 19 Dec 2022 at 19:38, <c.buhtz at posteo.jp> wrote:
>
> Dear Chris,
> thanks for asking back and my apologize for being to broad in my way of
> asking (in a foreign language).
>
> Am 19.12.2022 07:40 schrieb Chris Angelico:
> > Hmm, then I'm not sure what you're *losing* here. The problem, as I
> > understand it, is that the scripts are getting installed into
> > /usr/local/bin (which is on PATH at the time they're installed), but
> > pkexec has a restricted PATH. So if you use which before pkexec'ing,
> > wouldn't you find the scripts, and then be able to run them without
> > regard to PATH?
>
> Absolut correct. This works.
>
> The question is if this is a "good" or "elegant" way from the viewpoint
> of different communities/projects (e.g. Python, setuptools, pip, other
> build-systems, distros, something I forgot).
>

Ah! Then, my response is: Yes, it is definitely a good/elegant
solution. I've often created scripts that install into somewhere (eg
systemd, cron, ifupdown) by using 'which' to figure something out, and
then posting the full path into the corresponding file. It's a
convenient way to ensure that the exact same program would be used.

Notably, "which python3" will ensure that you run on the
currently-active Python interpreter; this includes virtual
environments. Very convenient.

ChrisA


More information about the Python-list mailing list