Error using fft: "RuntimeError: fft: ATen not compiled with MKL support"

Hi, I am having an issue with using fft. I installed pytorch using pip3 install torch torchvision on Mac OSX 10.11.6 with Python 3.6. I could not find much about this error online so I apologize if it’s something simple and appreciate any pointers.

Here is a minimal example:

import torch

x = torch.randn(4, 3, 2)
torch.fft(x, 2)

leads to the error

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-11-ca08a48f699a> in <module>()
      5 
      6 x = torch.randn(4, 3, 2)
----> 7 torch.fft(x, 2)

RuntimeError: fft: ATen not compiled with MKL support

Hi,

The problem is that the pip package does not ship MKL with it and MKL is required at the moment for fft support on cpu. If you use gpu tensors, that should work.

If you do need it on cpu, you can either install using conda as the conda package ships with MKL. Otherwise, you will have to install MKL on your machine and then compile from source.

1 Like

Thanks! I had tried installing MKL but missed the step about compiling from source.

Hi,
I have met the same question. I want to know how to compile from source. Thanks!