pyfftw - wheels fail to build because fftw libraries cannot be found

142 Views Asked by At

I've been trying to install FFTW and pyFFTW libraries on my macbook. I've managed to install the FFTW library via homebrew, and it is currently stored in the directory /opt/homebrew/Cellar/fftw

However, when I try to run pip install pyfftw I run into the following error (copy pasted from terminal; shortened it for simplicity but please let me know if the earlier information is needed):

  /var/folders/tq/nyll_l_92r94p57ry8z60bd80000gq/T/pyfftw-yym3ktj2/fftwl_plan_dft.c:2:17: error: call to undeclared function 'fftwl_plan_dft'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                  fftwl_plan_dft();
                  ^
  1 error generated.
  WARNING:__main__:Compilation error: command '/usr/bin/clang' failed with exit code 1
  DEBUG:__main__:clang -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/[username]/anaconda3/include -arch arm64 -fPIC -O2 -isystem /Users/[username]/anaconda3/include -arch arm64 -I/opt/homebrew/Cellar/fftw/3.3.10_1/include/ -I/private/var/folders/tq/nyll_l_92r94p57ry8z60bd80000gq/T/pip-install-wh14p0su/pyfftw_18d0e6b0f22d4654ba518a114fb808e0/include -I/private/var/folders/tq/nyll_l_92r94p57ry8z60bd80000gq/T/pip-install-wh14p0su/pyfftw_18d0e6b0f22d4654ba518a114fb808e0/pyfftw -I/private/var/folders/tq/nyll_l_92r94p57ry8z60bd80000gq/T/pip-build-env-3le0qyfi/overlay/lib/python3.11/site-packages/numpy/core/include -I/Users/[username]/anaconda3/include -I/Users/[username]/anaconda3/include/python3.11 -c /var/folders/tq/nyll_l_92r94p57ry8z60bd80000gq/T/pyfftw-yym3ktj2/fftwl_plan_dft.c -o /var/folders/tq/nyll_l_92r94p57ry8z60bd80000gq/T/pyfftw-yym3ktj2/fftwl_plan_dft.o
  
  DEBUG:__main__:Checking for fftwl_plan_dft...no
  DEBUG:__main__:{'HAVE_DOUBLE': False, 'HAVE_DOUBLE_OMP': False, 'HAVE_DOUBLE_THREADS': False, 'HAVE_DOUBLE_MULTITHREADING': False, 'HAVE_DOUBLE_MPI': False, 'HAVE_SINGLE': False, 'HAVE_SINGLE_OMP': False, 'HAVE_SINGLE_THREADS': False, 'HAVE_SINGLE_MULTITHREADING': False, 'HAVE_SINGLE_MPI': False, 'HAVE_LONG': False, 'HAVE_LONG_OMP': False, 'HAVE_LONG_THREADS': False, 'HAVE_LONG_MULTITHREADING': False, 'HAVE_LONG_MPI': False, 'HAVE_MPI': False}
  error: Could not find any of the FFTW libraries
  [end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pyfftw Failed to build pyfftw ERROR: Could not build wheels for pyfftw, which is required to install pyproject.toml-based projects

I've tried setting temporary environment variables, which were

export DYLD_LIBRARY_PATH=/opt/homebrew/Cellar/fftw/3.3.10_1/lib/
export LDFLAGS="-L/opt/homebrew/Cellar/fftw/3.3.10_1/lib/"
export CFLAGS="-I/opt/homebrew/Cellar/fftw/3.3.10_1/include/"

prior to running this, so I'm not sure where the error might be coming from. I've been looking at the installation guide online linked here.

Additionally, when calling locate libfftw, it says that there are libraries installed in directory /opt/homebrew/lib/. If go down the directory by hand, the directory is /opt/homebrew/Cellar/fftw/3.3.10_1/lib/, and the libraries are present there as well.

0

There are 0 best solutions below