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

martin smith gmane@blindgoat....
Wed Jun 1 10:45:15 CDT 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(
        library_dirs = [os.path.join(sf.get_python_lib(), 'numpy', 'fft')],
        define_macros = [('USE_FFTPACK', None)],
        libraries = [':fftpack_lite.so'],


    pymutt_module = Extension(
        libraries = ['fftw3'],

      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.

More information about the NumPy-Discussion mailing list