Fix for Python library path problem
Eric S. Raymond
esr at thyrsus.com
Wed Sep 27 21:08:08 UTC 2017
Fred Wright via devel <devel at ntpsec.org>:
> > Doesn't it? Look at my example again. It looks a lot like somebody, either
> > Python or Ubuntu's Python packagers, has gone to the effort to ensure that
> > FHS-compliant library directories under /usr/local/lib exist in parallel with
> > every system library directory under /usr/lib.
>
> Whether the directories exists isn't the point. No directories under
> /usr/local/lib are in the default sys.path. Hence directories of that
> form don't work for imports without special help. E.g.:
>
> fw at ubuntu:~$ python -c 'import sys; print(sys.path)'
> ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu',
> '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
> '/usr/lib/python2.7/lib-dynload', '/usr/lib/python2.7/dist-packages',
> '/usr/lib/python2.7/dist-packages/PILcompat',
> '/usr/lib/python2.7/dist-packages/gtk-2.0',
> '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
I see this:
esr at snark:~/software/ntp-rescue/ntpsec$ python -c 'import sys; print(sys.path)'
['', '/usr/local/lib/python2.7/dist-packages/lbrynet-0.2.0-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/appdirs-1.4.0-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/jsonrpc-1.2-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/lbryum-2.6-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/leveldb-0.193-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/unqlite-0.2.0-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/txJSON_RPC-0.3.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/python_bitcoinrpc-0.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/seccure-0.3.1.3-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/Yapsy-1.11.223-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/miniupnpc-1.9-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/Twisted-16.0.0-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/jsonrpclib-0.1.7-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/dnspython-1.12.0-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/protobuf-3.0.0b2-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/qrcode-5.2.2-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/pbkdf2-1.3-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/ecdsa-0.13-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/slowaes-0.1a1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/gmpy-1.17-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/temperusb-1.5.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/pyusb-1.0.0-py2.7.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/home/esr/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
I think the first thing we need to understand is why you and I, both using
Ubuntu systems, are seeing different sys.path values.
> As far as using the non-FHS location being "evil" goes, note:
> So most of the world elects to follow Python, not FHS.
Have that argument with Gary, not with me. If you can persuade him that
FHS nonconformance is not a big deal, we can just revert my massage()
patch and go. Having discovered that nobody complained about it over
7 or possibly 8 GPSD releases, I no longer care much.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.
More information about the devel
mailing list