site-packages versus site-python

Discussion in 'Python' started by enrio@online.no, Mar 5, 2005.

  1. Guest

    I recently installed python 2.4, and many installed software packages
    stopped working. Some things got working after I copied some files and
    directories from /usr/lib/python2.3/site-packages to
    /usr/lib/python2.4/site-packages, but I also had to install a newer
    PyXml package, as some of the files that came with python2.4 required a
    newer version of pyxml than I had in python2.3/site-packages.

    I wonder if there is any particular reason I have no
    /usr/lib/site-python directory, and everything is installed in
    version-specific site-packages.

    I have Fedora Core 3. Is it the Fedora packagers who prefer installing
    everything in the version-specific directory? Is there no way to have
    older packages continue working in the presence of python2.4? (I still
    want the newest to be the default!)

    I have tried (cd /usr/bin; grep '#!.*python' * 2>/dev/null), and very
    few of the programs have a specific version in the interpreter line. Is
    there any good reason this is so?

    Thinking about it, a particular python program may require a particular
    module, but not any particular version of python or the module. The
    module perhaps requires at least python2.3, but could run just as well
    with python2.4 or later. It does not make sense to have the program
    demand a particular version of python in its interpreter string (e.g.,
    "#!/usr/bin/python2.3"), but what about the module. Would it be better
    to put the module in site-python and include code to check the
    interpreter version?

    Perhaps there is no perfect solution that covers all permutations, but
    on the other hand, what is currently the "correct philosophy" of
    version handling?
     
    , Mar 5, 2005
    #1
    1. Advertising

  2. Steve Holden Guest

    wrote:
    > I recently installed python 2.4, and many installed software packages
    > stopped working. Some things got working after I copied some files and
    > directories from /usr/lib/python2.3/site-packages to
    > /usr/lib/python2.4/site-packages, but I also had to install a newer
    > PyXml package, as some of the files that came with python2.4 required a
    > newer version of pyxml than I had in python2.3/site-packages.
    >
    > I wonder if there is any particular reason I have no
    > /usr/lib/site-python directory, and everything is installed in
    > version-specific site-packages.
    >

    Well, broadly, the reason is that it allows version-specific code to be
    included in libraries.

    Of course, Python is so good at maintaining backward compatibility that
    it's unlikely a pure Python module will fail to run on the next version
    of Python. But you have to do this for extension modules, where the code
    is compiled against a specific version of the Python interpreter API,
    which doesn't stay the same from one version to the next.

    > I have Fedora Core 3. Is it the Fedora packagers who prefer installing
    > everything in the version-specific directory? Is there no way to have
    > older packages continue working in the presence of python2.4? (I still
    > want the newest to be the default!)
    >
    > I have tried (cd /usr/bin; grep '#!.*python' * 2>/dev/null), and very
    > few of the programs have a specific version in the interpreter line. Is
    > there any good reason this is so?
    >
    > Thinking about it, a particular python program may require a particular
    > module, but not any particular version of python or the module. The
    > module perhaps requires at least python2.3, but could run just as well
    > with python2.4 or later. It does not make sense to have the program
    > demand a particular version of python in its interpreter string (e.g.,
    > "#!/usr/bin/python2.3"), but what about the module. Would it be better
    > to put the module in site-python and include code to check the
    > interpreter version?
    >
    > Perhaps there is no perfect solution that covers all permutations, but
    > on the other hand, what is currently the "correct philosophy" of
    > version handling?
    >

    The current "correct" philosophy is to have version-specific libraries.
    Of course, there is nothing to stop you building your own
    *no*-version-specific library directory and configuring it on to the
    PYTHONPATH for each version you run.

    regards
    Steve
    --
    Meet the Python developers and your c.l.py favorites March 23-25
    Come to PyCon DC 2005 http://www.pycon.org/
    Steve Holden http://www.holdenweb.com/
     
    Steve Holden, Mar 5, 2005
    #2
    1. Advertising

  3. msoulier Guest

    > Well, broadly, the reason is that it allows version-specific code to
    be
    > included in libraries.


    I've actually found this to be a bit of a pain. I build packages
    against say, python2.2, and if you upgrade python to 2.3 the package
    breaks. The code works fine so saying it requires python >= 2.2 should
    be valid, but the version-specific path prevents that.

    Mike
     
    msoulier, Mar 6, 2005
    #3
  4. Steve Holden Guest

    msoulier wrote:
    >>Well, broadly, the reason is that it allows version-specific code to

    >
    > be
    >
    >>included in libraries.

    >
    >
    > I've actually found this to be a bit of a pain. I build packages
    > against say, python2.2, and if you upgrade python to 2.3 the package
    > breaks. The code works fine so saying it requires python >= 2.2 should
    > be valid, but the version-specific path prevents that.
    >
    > Mike
    >

    Well, if you can invent a reliable mechanism for managing
    version-independent extensions I'm sure the developers will be happy to
    hear about it :)

    regards
    Steve
    --
    Meet the Python developers and your c.l.py favorites March 23-25
    Come to PyCon DC 2005 http://www.pycon.org/
    Steve Holden http://www.holdenweb.com/
     
    Steve Holden, Mar 6, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Louden
    Replies:
    1
    Views:
    7,098
    Scott M.
    Oct 11, 2003
  2. Paul  Smith
    Replies:
    0
    Views:
    753
    Paul Smith
    Nov 18, 2003
  3. David Lyon
    Replies:
    19
    Views:
    608
    David Lyon
    Apr 24, 2009
  4. Paul Butcher
    Replies:
    12
    Views:
    775
    Gary Wright
    Nov 28, 2007
  5. Ian
    Replies:
    3
    Views:
    190
Loading...

Share This Page