Mailing List Archive

Should python installation modify /etc/paths.d on Mac OS X?
Hi,

The /etc/paths.d directory on Mac OS X contains the following
directory. Some packages have their PATH variables set there.

For Python, I have to set the PATH manually in my ~/.bashrc. Should
the Python developers consider setting PATH in /etc/paths.d as well?

==> /etc/paths.d/100-rvictl <==
/Library/Apple/usr/bin

==> /etc/paths.d/40-XQuartz <==
/opt/X11/bin

==> /etc/paths.d/com.vmware.fusion.public <==
/Applications/VMware Fusion.app/Contents/Public

--
Regards,
Peng
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/PHPM33FMHXUIA3PKOETKKX3IXZHOMPP5/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: Should python installation modify /etc/paths.d on Mac OS X? [ In reply to ]
On Jan 14, 2021, at 09:22, Peng Yu <pengyu.ut@gmail.com> wrote:
> The /etc/paths.d directory on Mac OS X contains the following
> directory. Some packages have their PATH variables set there.
>
> For Python, I have to set the PATH manually in my ~/.bashrc. Should
> the Python developers consider setting PATH in /etc/paths.d as well?
>
> ==> /etc/paths.d/100-rvictl <==
> /Library/Apple/usr/bin
>
> ==> /etc/paths.d/40-XQuartz <==
> /opt/X11/bin
>
> ==> /etc/paths.d/com.vmware.fusion.public <==
> /Applications/VMware Fusion.app/Contents/Public

Thanks for the suggestion. At first glance, that would seem to be an attractive option; it's something we've looked at recently. Unfortunately, there is a major usability issue with it on current macOS (10.15 Catalina and 11 Big Sur) where Apple now provides both a "python3' and a "pip3" stub in /usr/bin that link to versions they supply in current Xcode or Command Line Tools releases. Those versions are supplied primarily to support other Xcode tools and are not intended to provide a full user Python installation.

The problem is that paths added via /etc/paths.d are appended to PATH *after* /usr/local/bin and /usr/bin so it is not possible to override "python3" and "pip3" this way.

We are still considering ways to improve the path management for python.org installers on macOS but simply relying on /etc/paths.d isn't sufficient, alas.

--
Ned Deily
nad@python.org -- []
Re: Should python installation modify /etc/paths.d on Mac OS X? [ In reply to ]
> On 14 Jan 2021, at 14:22, Peng Yu <pengyu.ut@gmail.com> wrote:
>
> Hi,
>
> The /etc/paths.d directory on Mac OS X contains the following
> directory. Some packages have their PATH variables set there.
>
> For Python, I have to set the PATH manually in my ~/.bashrc. Should
> the Python developers consider setting PATH in /etc/paths.d as well?
>
> ==> /etc/paths.d/100-rvictl <==
> /Library/Apple/usr/bin
>
> ==> /etc/paths.d/40-XQuartz <==
> /opt/X11/bin
>
> ==> /etc/paths.d/com.vmware.fusion.public <==
> /Applications/VMware Fusion.app/Contents/Public

One of the things that I wish the python macOS installed would stop doing is
editing my .bashrc/.zshrc etc.

After each python install I have to undo the edits to .bashrc or .zshrc that break
my environment.

I understand the motivation to do this. But please provide a why to turn this off
for for people like me that have many versions of python installed.

I think of two things that could be checked for.
1. A marked in the .bashrc/.zshrc file. '# python-disable-path-edit'
2. A file in ~/Library somewhere that disabled the behavour

Barry



>
> --
> Regards,
> Peng
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-leave@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/PHPM33FMHXUIA3PKOETKKX3IXZHOMPP5/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/WD4LS4LCRUC3G6O3PWOAK5NXL3MO3IGB/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: Should python installation modify /etc/paths.d on Mac OS X? [ In reply to ]
On Jan 18, 2021, at 08:24, Barry Scott <barry@barrys-emacs.org> wrote:
> One of the things that I wish the python macOS installed would stop doing is
> editing my .bashrc/.zshrc etc.
>
> After each python install I have to undo the edits to .bashrc or .zshrc that break
> my environment.
>
> I understand the motivation to do this. But please provide a why to turn this off
> for for people like me that have many versions of python installed.

As discussed elsewhere, we are looking at other ways to manage this. However, there is already an option to turn this off. When installing a python.org Python pkg from the macOS Installer app, at the fifth step, "Installation Type", there is a "Customize" button; clicking on that brings up a list of the installer's packages including "Shell profile updater"; just uncheck that before proceeding. If you are using the command line "installer" program, you can use its -showChoicesXML option to get the .pkg choices and modify it to disable the profile changes package.

--
Ned Deily
nad@python.org -- []
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/PA47EBL45SZJ2JYFLR7XVUELC6ZPJ6GM/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: Should python installation modify /etc/paths.d on Mac OS X? [ In reply to ]
Ned Deily <nad@python.org> writes:

> On Jan 14, 2021, at 09:22, Peng Yu <pengyu.ut@gmail.com> wrote:
>> The /etc/paths.d directory on Mac OS X contains the following
>> directory. Some packages have their PATH variables set there.
>>
>> For Python, I have to set the PATH manually in my ~/.bashrc. Should
>> the Python developers consider setting PATH in /etc/paths.d as well?
>>
>> ==> /etc/paths.d/100-rvictl <==
>> /Library/Apple/usr/bin
>>
>> ==> /etc/paths.d/40-XQuartz <==
>> /opt/X11/bin
>>
>> ==> /etc/paths.d/com.vmware.fusion.public <==
>> /Applications/VMware Fusion.app/Contents/Public
>
> Thanks for the suggestion. At first glance, that would seem to be an
> attractive option; it's something we've looked at
> recently. Unfortunately, there is a major usability issue with it on
> current macOS (10.15 Catalina and 11 Big Sur) where Apple now provides
> both a "python3' and a "pip3" stub in /usr/bin that link to versions
> they supply in current Xcode or Command Line Tools releases. Those
> versions are supplied primarily to support other Xcode tools and are
> not intended to provide a full user Python installation.
>
> The problem is that paths added via /etc/paths.d are appended to PATH
> *after* /usr/local/bin and /usr/bin so it is not possible to override
> "python3" and "pip3" this way.
>
> We are still considering ways to improve the path management for
> python.org installers on macOS but simply relying on /etc/paths.d
> isn't sufficient, alas.

Probably very recently (Big Sur), but MacOS has stopped adding
/etc/paths.d into default PATH env variable. /etc/paths.d is loaded only
when you call

eval "$(/usr/libexec/path_helper)"

So, I had to add the above command in my ~/.bash_profile (interactive
login) to load my various utilities like TeX.

--
Regards,
Pankaj Jangid

GnuPG Fingerprint: 0B62 7424 3B26 A911 052A DDE6 7C95 6E6F F858 7689
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/SFNA6D6FQQARQHYRHGITOIA3SNCH7DZZ/
Code of Conduct: http://python.org/psf/codeofconduct/