[Numpy-discussion] need help building a numpy extension that uses fftpack on windows

martin smith gmane at blindgoat.org
Wed Jun 1 11:45:15 EDT 2011


I have a bit of code that performs multi-taper power spectra using numpy
and a C extension module.  The C portion consists of an interface file
and a python-unaware computational file.  The latter invokes fftpack.

The straightforward setup.py appended below works fine on Linux.  On
Windows using MinGW it's not so good. I first created a libpython27.a
file following instructions on the web.  The C code now compiles but
fails to link since there is no fftpack_lite.so on Windows.  I can't
find an fftpack_lite.dll (or even the source for fftpack_lite) and don't
know where to turn.

Trying to sort these problems out in Windows is (to me) difficult and
bewildering.  I'd much appreciate any advice.

- martin smith

(BTW: the code is unencumbered and available for the asking.)


----------------------------------------------------------------------
from numpy.distutils.core import setup
from numpy.distutils.extension import Extension
import os.path
import distutils.sysconfig as sf

use_fftpack = 1

if use_fftpack:

    pymutt_module = Extension(
        'pymutt',
        ['pymutt.c'],
        library_dirs = [os.path.join(sf.get_python_lib(), 'numpy', 'fft')],
        define_macros = [('USE_FFTPACK', None)],
        libraries = [':fftpack_lite.so'],
        )

else:

    pymutt_module = Extension(
        'pymutt',
        ['pymutt.c'],
        libraries = ['fftw3'],
        )

setup(name='pymutt',
      version='1.0',
      description = "numpy support for multi-taper fourier transforms",
      author = "Martin L. Smith",
      long_description =
'''
Implements a numpy interface to an implementation of Thomson's
multi-taper fourier transform algorithms.  The key C module (mtbase.c)
is derived from code written and made freely available by J. M. Lees and
Jeff Park.
''',
      ext_modules=[pymutt_module],
    )
----------------------------------------------------------------------------------------




More information about the NumPy-Discussion mailing list