2

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.

ch0l1n3
  • 275
  • 3
  • 9
  • 2
    Did you install it? This package does not come with Python. – Two-Bit Alchemist Aug 06 '15 at 20:25
  • What I mean is I can't find the installation for this package... Maybe I'm an idiot, I've been searching for the past 2 hours! – ch0l1n3 Aug 06 '15 at 20:26
  • I believe you should `pip install pyfftw3` because that is the name of the package on PyPI. Then try `import fftw3`. (Note the name of the top level module does not necessarily have to match the name of the package.) – Two-Bit Alchemist Aug 06 '15 at 20:31
  • Are you getting an error message from `pip`? – Will Aug 06 '15 at 20:33
  • It says I already have the requirement satisfied, but I believe that's because pyfftw3 is the package pyfftw? Which isn't the same as fftw3. – ch0l1n3 Aug 06 '15 at 20:37
  • Also @Will If I try to install fftw3 I get the does not exist error... – ch0l1n3 Aug 06 '15 at 20:38
  • Whoever voted to close this question as being about "general computing hardware and software" seems to have absolutely no idea what this question is about. – Two-Bit Alchemist Aug 06 '15 at 20:40
  • Damn... so now people can't answer my question :(? – ch0l1n3 Aug 06 '15 at 20:44
  • Hmm I got it installed with `sudo pip install pyfftw3` and then in python `import fftw3`. I'm on Linux Mint Debian 2. – Will Aug 06 '15 at 20:45
  • Thank you Will! So... To solve my issue I removed the pyfftw3 package and then I reinstalled again and now I can import fftw3. Bizarre... I'm really sorry about this, I didn't think this could be an issue. – ch0l1n3 Aug 06 '15 at 20:49

2 Answers2

3

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()
Will
  • 4,299
  • 5
  • 32
  • 50
2

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
Santi Peñate-Vera
  • 1,053
  • 4
  • 33
  • 68