Read to the end before doing anything.
The error means that a DLL cannot find another DLL that it was linked with. But which other DLL?
- Download Dependencies.
- Locate your problematic DLL.
In this specific case: Locate the folder ...\Lib\site-packages\finufft\
of the FINUFFT installation that you want to fix. ...\
is the path of your standard python installation or of your python virtual environment.
- Start
DependenciesGui.exe
and use it to open the problematic DLL, e.g. ...\finufft\_finufft.cp38-win_amd64.pyd
. (A .pyd
is a regular DLL with some specific entry points for python.)
- On the left, you will see a complete list of the problematic DLL's direct dependencies, whose dependencies you can in turn unfold by mouse click. Apart from typical Windows-DLLs, like
kernel32.dll
and MSVCRT.dll
, and apart from the FFTW-DLLs, which should already be in the FINUFFT-folder, there will also be some - possibly missing - Linux-DLLs. For me, it was libgcc_s_seh-1.dll
, libgomp-1.dll
and libstdc++-6.dll
. By checking their direct dependencies, I also discovered libwinpthread-1.dll
as missing.
- [See EDIT below!!!] I found those DLLs in Anaconda (
...\Anaconda3\Library\mingw-w64\bin\
), but you can probably also get them from cygwin (...\cygwin64\bin\
), git (...\Git\mingw64\bin\
) or anything else that downloads mingw64
and its packages on Windows.
- To solve the problem, copy the respective DLLs into
...\Lib\site-packages\finufft\
and give them the exact filenames that the FINUFFT-DLL is expecting according to Dependencies. This works because Windows and because of the Windows DLL search order.
Now, import finufft
should work in the specific python environment whose FINUFFT installation you fixed. Clearly, this method can be applied anytime DLL dependencies are missing.
EDIT - correction of my answer by @CristiFati: If possible, DLLs and similar things should always be built with the same toolchain. So if you don't compile them yourself, get them from as few different places as possible, i.e. don't mix regular python, Anaconda, cygwin, etc. - if possible. Of course, Windows DLLs will have a different origin from Linux DLLs.