If you are trying to debug something like:
  ImportError: No module named ntp
you have come to the right place.

The default location where we install our python libraries is
  /usr/local/lib/pythonX.Y/site-packages/
where X and Y are the python version numbers.

Unfortunately, that's not on the default search path of several
OSes/distros, in particular Fedora and NetBSD.


Python has a search path that is used to find library modules when
you import them.  You can see your search path with:
  python2 -c "import sys; print sys.path"
or
  python3 -c "import sys; print(sys.path)"

Info on Python's search path:
  https://docs.python.org/2/tutorial/modules.html
or
  https://docs.python.org/3/tutorial/modules.html



There are several ways to make things work.

1: You can modify the location where waf will install the libraries.
For NetBSD, something like this should work:
  ./waf configure \
    --pythondir=/usr/pkg/lib/python2.7/site-packages \
    --pythonarchdir=/usr/pkg/lib/python2.7/site-packages \
    ...
You need to specify it at configure time.  Install time is too late.


2: You can setup your PYTHONPATH with something like this:
  export PYTHONPATH=/usr/local/lib/python2.7/site-packages
For bash, you can add that line to your .bashrc or the system /etc/bashrc
If you don't put it in the system file, all users will have to do this,
including root if root uses any ntp scripts.


3: You can add to the default search path by setting up a .pth file
with something like this:
  echo /usr/local/lib/python2.7/site-packages > \
    /usr/lib/python2.7/site-packages/ntpsec.pth
This works for all users, including root.
Note that the pth file must be on the default Python search path.


OTOH if you run into something like:
    Traceback (most recent call last):
      File "/usr/bin/ntpdig", line 419, in <module>
        timeout=timeout)
      File "/usr/bin/ntpdig", line 109, in queryhost
        keyid, keytype, passwd)
      File "/usr/lib/python3/dist-packages/ntp/packet.py", line 1747, in compute_mac
        if not ntp.ntpc.checkname(keytype):
    AttributeError: module 'ntp.ntpc' has no attribute 'checkname'

Then you probably want to either uninstall the previous Python extension, or
install one after 1.1.9 (798b93) by adding the '--enable-pylib ext' option
without quotes.

OTOH if you are running into something like:
    Traceback (most recent call last):
    File "/usr/bin/ntpdig", line 19, in <module>
        import ntp.packet
    File "/usr/lib/python3/dist-packages/ntp/packet.py", line 219, in <module>
        import ntp.ntpc
    File "/usr/lib/python3/dist-packages/ntp/ntpc.py", line 52, in <module>
        _ntpc = _importado()
    File "/usr/lib/python3/dist-packages/ntp/ntpc.py", line 38, in _importado
        return _dlo(ntpc_paths)
    File "/usr/lib/python3/dist-packages/ntp/ntpc.py", line 49, in _dlo
        raise OSError("Can't find %s library" % LIB)
    OSError: Can't find ntpc library

That means is that ntpc.py looked for libnptc.so in the usual places and could
not find it.  If it is being installed to the wrong location on your platform,
you can correct the install location using: waf configure --libdir=  If you
are intentionally installing to a non-default location, you can modify the
dynamic linker's search path globally (e.g. /etc/ld.so.conf or
/etc/ld.so.conf.d/) or in your environment (e.g. LD_LIBRARY_PATH).

On some platforms, it is necessary to run ldconfig after installing libraries.
This is normally done by the waf install step, but it may have failed.  When
using a temporary --destdir (e.g. as part of package builds), ldconfig must be
run manually after the library is installed to its final location.
