xtensor-stack / xtensor-blas

BLAS extension to xtensor
BSD 3-Clause "New" or "Revised" License
157 stars 55 forks source link

using xt::linalg::dot results in DLL not found when importing module #164

Open Coderx7 opened 4 years ago

Coderx7 commented 4 years ago

What are the dependencies other than openblas/lapack? since I installed everything that was noted in the installation guide here. The compilation goes without a hitch, but when I import the actual module, it gives the error :

ImportError: DLL load failed: The specified module could not be found.

I analyzed the resulting pyd file, and all Dlls are in Path : image

What else is needed to be installed, as I'm clueless here! I'm on Windows 10 1909 x64 Anaconda 3 Python3.6.7 x64 latest version of xtensor and xtensor-blas (as of 6/3/2020)

Installed openblas and lapack using conda:

conda install -c conda-forge openblas 
conda install -c conda-forge lapack

I also installed MKL and Intelopenmp using pip :

pip install intel-openmp
pip install mkl 

Yet the problem still persists. Any help is greatly appreciated

Coderx7 commented 4 years ago

Thanks to dear God I finally found out the cause, basically flang.dll and libomp.dll were required. the first one is a fortran requirement and the second one is a openmp requirement. In other words one had to install both of them.

conda install -c conda-forge openmp

flang.dll should exist in your anaconda distribution (mine was at C:\Users\Hossein\Anaconda3\pkgs\libflang-5.0.0-vc14_20180207\Library\bin), if you dont have it you can install it using

conda install -c conda-forge libflang

After installation you need to add the dll path to your PATH environment so its accessible everywhere. mine was at C:\Users\Hossein\Anaconda3\pkgs\openmp-5.0.0-vc14_0\Library\bin

IMHO, This must be pointed out in the documentation as well. as it nearly took me 2 full days until I found the issue!

yechs commented 3 years ago

Thank you! I faced the same problem and this issue saved me.

Also, just want to point out that all the dlls are included in the path C:\Users\<username>\Miniconda3\Library\bin, so just adding that path to environment variable PATH would suffice (instead of adding one for each package).