I can't find python package fftw3

5.6k Views Asked by At

I'm trying to use fftw3 on python to compute ffts really fast (using all my cores!) The problem is... I can't find the fftw3 package for python... I know it exists because the function I need uses it if and only if it's installed.

This is the module that I use: https://github.com/keflavich/image_tools/blob/master/fft_psd_tools/convolve_nd.py

And as expected this is what I get if I try to import it:

>>> import fftw3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named fftw3
>>>

And I've tried this:

sudo pip install fftw3
sudo apt-get install python-fftw3
sudo easy_install fftw3

And I have also tried googling for its location, or installation instructions, with nothing to be found!

I am also aware that fftw is a C library and that pyfftw exists as python wrappers for that package, but the function I use utilizes fftw3.

I am hoping someone could point me to where this module is located!

P.S. I am running Ubuntu 14.04 and I'm using python 2.7. I also tried importing it in python 3 but it's not there either.

2

There are 2 best solutions below

2
On BEST ANSWER

Looks like the problem was with the package you were trying to pip. I had no errors with sudo pip install pyfftw3 then import fftw3

will@will-mint2 ~ $ sudo pip install pyfftw3
[sudo] password for will: 
Downloading/unpacking pyfftw3
  Downloading PyFFTW3-0.2.1.tar.gz
  ...
  Successfully installed pyfftw3
Cleaning up...
will@will-mint2 ~ $ python
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fftw3
>>> exit()
0
On

For windows

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyfftw

install it by:

pip install [filename].whl

import in your code by

import pyfftw as fftw