On one server I'm able to import a library, on a second one I'm not. The library I need to import is shared via NFS and reachable by both servers.
I found out that the Python path is different between the two servers, but the Python binary is the same, installed from standard ubuntu 16.04 repos, and $PYTHONPATH
is unset on both servers.
Server 1:
$ echo $PYTHONPATH
$ python
>>> import sys; sys.path
['', '/usr/lib/python2.7', '...', '/usr/local/lib/python2.7/dist-packages', '/home/user/app/src/python', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/wx-3.0-gtk2']
Server 2:
$ echo $PYTHONPATH
$ python
>>> import sys; sys.path
['', '/usr/lib/python2.7', '...', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
How do I understand where is this library defined, in order to replicate the same behaviour to server 2?
The curious fact is that the library is placed between the paths /usr/local/lib
and /usr/lib
.
Edit: The python binary is the same (same version 2.7.12, and the checksums match) and it's installed from the ubuntu repos in the standard location /usr/bin/python
.
I've played with the library site
and all variables are the same (site.ENABLE_USER_SITE
returns True).
I know I can manipulate the paths inside the script, or specify PYTHONPATH
in /etc/profile.d/ for all servers, but I'd like to know where is the difference.