[SC.LUG] special treatment of /usr/local on linux.

David Holden dh at iucr.org
Mon Jul 24 21:26:24 BST 2006


On Monday 24 July 2006 21:15, John Southern wrote:
> On Monday 24 July 2006 10:51, David Holden wrote:
> >    Ubuntu (and fedora) have some system config apps that use python.
> > e.g.
> >  gnome-app-install
> >  Any ideas?
>
> Which version of Ubuntu? Early Warty had a problem with missing distutils
> which was needed for some of the configuration stuff.
>
> /usr/local is the correct default path as set in
> http://docs.python.org/lib/module-sys.html
>
> Is there a chance you have installed Firefox 1.5? and not the Ubuntu
> patched firefox? If so, it may be worth removing FF1.5, installing FF1.07
> (Ubuntu version) then installing FF1.5 in a separate location.
>
> Regards
> John
>
> _______________________________________________
> SC mailing list
> SC at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/sc


 Hi John,

 Thanks for the reply.

 I'm running dapper.  I've found the cause of the problem.

Even though the ubuntu version of python is installed in /usr its default path 
for importing libraries is

>>> import sys
>>> print sys.path
['', '/usr/lib/python24.zip', '/usr/lib/python2.4', '/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages', '/usr/local/lib/python2.4/site-packages/PIL', '/usr/local/lib/python2.4/site-packages/gtk-2.0', '/usr/lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages/HTMLgen', '/usr/lib/python2.4/site-packages/Numeric', '/usr/lib/python2.4/site-packages/PIL', '/usr/lib/python2.4/site-packages/cairo', '/usr/lib/python2.4/site-packages/gst-0.10', '/usr/lib/python2.4/site-packages/gtk-2.0']

i.e. it defaults to importing things from /usr/local for some things 
before /usr.


I don't understand why it would be set up to do this but there we are.


Since I have a version of python in /usr/local also it looks like its causing 
conflicts because its trying to import libraries from here first.

So far the only way I've found of stopping this is to reset sys.path in the 
python program itself (not exactly ideal!).

There is a env variable PYTHONPATH but this just seems to allow you to added 
to the path rather than reset or remove entries.


I'm pretty annoyed at this, but I'm sure the packager/python people had good 
reason  to set it up like this. Oh well.

    
    Dave.








-- 
Dr. David Holden.

See: <http://www.gnu.org/philosophy/no-word-attachments.html>
regarding Word or PowerPoint. GPG key available on request.
-------------------------------------------------------------



More information about the SC mailing list