[Python-Dev] Location of OS-installed versus Python-installed libraries (was: Proposed: add an environment variable, PYTHONPREFIXES)

Ben Finney ben+python at benfinney.id.au
Thu Apr 23 11:13:13 CEST 2009

Larry Hastings <larry at hastings.org> writes:

> the Debian package mantainer for Python decided to change
> "site-packages" to "dist-packages" in 2.6, for reasons I still don't
> quite understand.

For reference, Larry is referring to changes announced by Matthias Klose
on 2009-02-16 in Message-ID: <18841.49052.405847.359567 at gargle.gargle.HOWL>

> Local installation path
> -----------------------
> When installing Python modules using distutils, the resulting files
> end up in the same location wether they are installed by a Debian
> package, or by a local user or administrator, unless the installation
> path is overwritten on the command line.  Compare this with most
> software based on autoconf, where an explicit prefix has to be
> provided for the packaging, while the default install installs into
> /usr/local.  For new Python versions packaged in Debian this will
> change so that an installation into /usr (not /usr/local) requires an
> extra option to distutils install command (--install-layout=deb).  To
> avoid breaking the packaging of existing code the distutils install
> command for 2.4 and 2.5 will just accept this option and ignore it.
> For the majority of packages we won't see changes in the packaging,
> provided that the python packaging helpers can find the files in the
> right location and move it to the expected target path.
> A second issue raised by developers was the clash of modules and
> extensions installed by a local python installation (with default
> prefix /usr/local) with the modules provided by Debian packages
> (/usr/local/lib/pythonX.Y/site-packages shared by the patched "system"
> python and the locally installed python.  To avoid this clash the
> directory `site-packages' should be renamed to `dist-packages' in
> both locations:
>  - /usr/lib/pythonX.Y/dist-packages (installation location for code
>    packaged for Debian)
>  - /usr/local/lib/pythonX.Y/dist-packages (installation location
>    for locally installed code using distutils install without
>    options).
> The path /usr/lib/pythonX.Y/site-packages is not found on sys.path
> anymore.
> About the name: Discussed this with Barry Warsaw and Martin v. Loewis,
> and we came to the conclusion that using the same directory name for
> both locations would be the most consistent way.

 \         “In any great organization it is far, far safer to be wrong |
  `\          with the majority than to be right alone.” —John Kenneth |
_o__)                                            Galbraith, 1989-07-28 |
Ben Finney

More information about the Python-Dev mailing list