Why should I install Python packages into `~/.local`?
- by Matthew Rankin
Background
I don't develop using OS X's system provided Python versions (on OS X 10.6 that's Python 2.5.4 and 2.6.1).
I don't install anything in the site-packages directory for the OS provided versions of Python. (The only exception is Mercurial installed from a binary package, which installs two packages in the Python 2.6.1 site-packages directory.)
I installed three versions of Python, all using the Mac OS X installer disk image:
Python 2.6.6
Python 2.7
Python 3.1.2
I don't like polluting the site-packages directory for my Python installations. So I only install the following five base packages in the site-packages directory. For the actual method/commands used to install these, see SO Question 4324558.
setuptools/ez_setup
distribute
pip
virtualenv
virtualenvwrapper
All other packages are installed in virtualenvs.
I am the only user of this MacBook.
Questions
Given the above background, why should I install the five base packages in ~/.local? Since I'm installing these base packages into the site-packages directories of Python distributions that I've installed, I'm isolated from the OS X's Python distributions.
Using this method, should I be concerned about Glyph's comment that other things could potentially break (see his comment below)?
Again, I'm only interested in where to install those five base packages.
Related Questions/Info
I'm asking because of Glyph's comment to my answer to SO question 4314376, which stated:
NO. NEVER EVER do sudo python setup.py install whatever. Write a ~/.pydistutils.cfg that puts your pip installation into ~/.local or something. Especially files named ez_setup.py tend to suck down newer versions of things like setuptools and easy_install, which can potentially break other things on your operating system.
Previously, I asked What's the proper way to install pip, virtualenv, and distribute for Python?. However, no one answered the "why" of using ~/.local.