Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: DLL load failed while importing _pydfti #72

Open
JeroenBax opened this issue Sep 20, 2022 · 10 comments
Open

ImportError: DLL load failed while importing _pydfti #72

JeroenBax opened this issue Sep 20, 2022 · 10 comments

Comments

@JeroenBax
Copy link

Hi,

I installed the mkl_fft library via pip, when running my code I get the following error,

ImportError: DLL load failed while importing _pydfti: The specified module could not be found

Does anyone know what can cause this error?
Thanks in advance!

@oleksandr-pavlyk
Copy link
Collaborator

@JeroenBax Could you please be more specific? Did you do pip install mkl_fft, or python -m pip install --i https://pypi.anaconda.org/intel/simple -extra-index-url https://pypi.org/simple mkl_fft ?

Do you have MKL library installed in your Python environment as well?

@JeroenBax
Copy link
Author

Thanks for the quick reply,
I used the "python -m pip install --i https://pypi.anaconda.org/intel/simple -extra-index-url https://pypi.org/simple mkl_fft" command to download the library, which is installed in my Python environment as well.
The error occurs in the init.py file where ._pydfti is unknown

@oleksandr-pavlyk
Copy link
Collaborator

oleksandr-pavlyk commented Sep 20, 2022

It may happen because, while importing _pydfti native extension the MKL library can not be loaded. Let me try to reproduce this behavior. What version of Python are you using?

@JeroenBax
Copy link
Author

Version 3.8.10

@oleksandr-pavlyk
Copy link
Collaborator

Using pip 22.1.2 I am getting an error:

(try-mkl-fft) C:\Users\opavlyk>python -m pip install --i https://pypi.anaconda.org/intel/simple -extra-index-url https://pypi.org/simple mkl_fft

Usage:
  C:\Users\opavlyk\Miniconda3\envs\try-mkl-fft\python.exe -m pip install [options] <requirement specifier> [package-index-options] ...
  C:\Users\opavlyk\Miniconda3\envs\try-mkl-fft\python.exe -m pip install [options] -r <requirements file> [package-index-options] ...
  C:\Users\opavlyk\Miniconda3\envs\try-mkl-fft\python.exe -m pip install [options] [-e] <vcs project url> ...
  C:\Users\opavlyk\Miniconda3\envs\try-mkl-fft\python.exe -m pip install [options] [-e] <local project path> ...
  C:\Users\opavlyk\Miniconda3\envs\try-mkl-fft\python.exe -m pip install [options] <archive url/path> ...

ambiguous option: --i (--ignore-installed, --ignore-requires-python, --implementation, --index-url, --install-option, --isolated?)

Correcting that I get another error:

(try-mkl-fft) C:\Users\opavlyk>python -m pip install -i https://pypi.anaconda.org/intel/simple -extra-index-url https://pypi.org/simple mkl_fft
ERROR: xtra-index-url is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).
WARNING: There was an error checking the latest version of pip.

@JeroenBax
Copy link
Author

JeroenBax commented Sep 20, 2022

Yes, I got indeed the same errors, writing --index-url instead of --i and --extra-index-url instead of -extra-index-url, solves the error

@oleksandr-pavlyk
Copy link
Collaborator

It does not for me:

(try-mkl-fft) C:\Users\opavlyk>python -m pip install --index-url https://pypi.anaconda.org/intel/simple -extra-index-url https://pypi.org/simple mkl_fft
ERROR: xtra-index-url is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).
WARNING: There was an error checking the latest version of pip.

@JeroenBax
Copy link
Author

You should type an extra minus sign before the -extra-index-url. So make it --extra-index-url.
That solved the error for me

@oleksandr-pavlyk
Copy link
Collaborator

Please try

python -c "import sysconfig, os, ctypes, glob; mkl_fft_dir = os.path.join(sysconfig.get_path('purelib'), 'mkl_fft'); lib = glob.glob(os.path.join(mkl_fft_dir, '_pydfti*')); print(ctypes.cdll.LoadLibrary(lib[0])) if lib else print('lib was empty')"

For me, it outputs

(try-mkl-fft) C:\Users\opavlyk>python -c "import sysconfig, os, ctypes, glob; mkl_fft_dir = os.path.join(sysconfig.get_path('purelib'), 'mkl_fft'); lib = glob.glob(os.path.join(mkl_fft_dir, '_pydfti*')); print(ctypes.cdll.LoadLibrary(lib[0])) if lib else print('lib was empty')"
<CDLL 'C:\Users\opavlyk\Miniconda3\envs\try-mkl-fft\Lib\site-packages\mkl_fft\_pydfti.cp38-win_amd64.pyd', handle 7ff9110e0000 at 0x26756728880>

This could shed additional light as to why the library fails to import.

@oleksandr-pavlyk
Copy link
Collaborator

You should type an extra minus sign before the -extra-index-url. So make it --extra-index-url. That solved the error for me

Thank you, it worked indeed. I will updated README in the repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants