[Fedora-packaging] Why do Fedora python packages install in site-packages?

Richard W.M. Jones rjones at redhat.com
Thu Dec 9 20:30:40 UTC 2010

On Thu, Dec 09, 2010 at 09:40:04AM -0800, Toshio Kuratomi wrote:
> On Thu, Dec 09, 2010 at 12:44:36PM +0000, Richard W.M. Jones wrote:
> > 
> > I'm confused why Fedora Python packages get installed in
> > /usr/lib/python*/site-packages/.
> > 
> > Looking at the upstream Python documentation[1] it seems this
> > directory is reserved for packages installed by the local system
> > administrator.  (Similar to the Perl distinction between
> > 
> I don't see where the distinction is being made between local system admin
> and vendor in that document.  Could you give a better link or a search term?

Maybe I can explain the Perl situation better.

"site" (on Fedora this is /usr/local/share/perl5) is where the system
admin installs packages using:

  perl Makefile.PL ; make ; sudo make install

"vendor" (/usr/share/perl5/vendor_perl from Rawhide onwards) is where
the package manager puts Perl packages which aren't in the core Perl.

"core" (/usr/share/perl5) is where core parts of Perl go and packages
which are shipped in the perl tarball.

The idea AIUI is that admin-installed packages survive Perl upgrades
or cases where Perl is removed and reinstalled.  If you use the 'cpan'
command line tool on Fedora, the packages get installed in "site".

> Also, on an FHS compliant Linux system, the system administrator would not
> use /usr/lib/pythonX.Y/site-packages anyway.  They'd use something like
> /usr/local/lib/pythonX.Y/site-packages.

Indeed, and Debian puts site-packages under /usr/local as you've
described, which is where I came across the problem in the first place
(trying to build a package for Debian and noticing this is different
from Fedora).

Debian also creates /usr/share/pyshared but I've yet to understand
exactly why.


> In this setup, it seems like Debian is not putting anything in
> site-packages.  Without more information, their use of dist-packages just 
> seems arbitrary and non-standard.

I think the Perl case makes some sense, if one accepts that there is a
difference between "core" and "vendor" (maybe this difference is too
artificial).  Upstream Python documentation doesn't really cover the
case of package managers at all.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html

More information about the packaging mailing list