pyFFTW doesn't find libfftw3l.so while import
Question: In my Raspbian system I have succesfully installed pyFFTW, but there is a
problem while import package.

    
    
      import pyfftw
        File "/usr/local/lib/python3.4/dist-packages/pyfftw/__init__.py", line 16, in <module>
      from .pyfftw import ( 
    ImportError: libfftw3l.so.3: cannot open shared object file: No such file or directory
    

Actually, I have FFTW installed from source.

* * *

I've dig into __init__.py and there is an **relative import** line:

    
    
    from .pyfftw import (
                  FFTW
                  blah blah )
    

there is no module pyfftw in the . folder but I suppose this line indicates to
./**pyfftw.cpython-34m.so** file which probably wraps C code of FFTW.

How to tell to this pyfftw.cpython-34m.so file where it should look for
correct path?


Answer: The problem was with PYTHONPATH.

To check if the file is somewhere at the disk:

    
    
    $ sudo file / -name libfftw3l.so.3
    /home/pi/bin/fftw-3.3.5/.libs/libfftw3.so.3
    /usr/lib/arm-linux-gnueabihf/libfftw3.so.3
    /usr/local/lib/libfftw3.so.3
    

And add a line before import pyfftw (see
[here](https://docs.python.org/3/tutorial/modules.html "here")):

    
    
    import sys
    sys.path.append('/usr/local/lib/libfftw3.so.3')
    

