intel-extension-for-pytorch icon indicating copy to clipboard operation
intel-extension-for-pytorch copied to clipboard

The specified module could not be found.

Open sifatk69 opened this issue 1 year ago • 3 comments

Describe the issue

[WinError 126] The specified module could not be found. Error loading "C:\Users\Admin\pythonProject\lib\site-packages\torch\lib\backend_with_compiler.dll

sifatk69 avatar Oct 13 '23 12:10 sifatk69

This is a follow up to https://github.com/intel/intel-extension-for-pytorch/issues/409?

According to this thread https://github.com/pytorch/pytorch/issues/87695#issuecomment-1302036775, it seems like a potential pathing issue. Could you try setting the appropriate equivalent path for your env?

set PATH=%PATH%;C:\Projects\pytorch\Miniconda3\pkgs\intel-openmp-2021.4.0-haa95532_3556\Library\bin (otherwise the import fails with OSError: [WinError 126] The specified module could not be found. Error loading "C:\Projects\pytorch\torch\lib\backend_with_compiler.dll" or one of its dependencies.)

kta-intel avatar Oct 17 '23 20:10 kta-intel

This is a follow up to #409?

According to this thread pytorch/pytorch#87695 (comment), it seems like a potential pathing issue. Could you try setting the appropriate equivalent path for your env?

set PATH=%PATH%;C:\Projects\pytorch\Miniconda3\pkgs\intel-openmp-2021.4.0-haa95532_3556\Library\bin (otherwise the import fails with OSError: [WinError 126] The specified module could not be found. Error loading "C:\Projects\pytorch\torch\lib\backend_with_compiler.dll" or one of its dependencies.)

would you please give me a sample how to set the correct path in the env for this case. It seems there is no intel-openmp installation mentioned in the guideline.

sxunix avatar Nov 11 '23 09:11 sxunix

Are you using conda? I think it should just be in your conda path (i.e. ${PATH_TO_CONDA}/pkgs/intel-openmp-{version})

But also, I am unsure if this is the solution. I have not heard from the original reporter and don't have a system readily available to try to reproduce it

kta-intel avatar Nov 17 '23 23:11 kta-intel

@sxunix and all, generally the error caused by environment. Please follow the install step of Intel extension for pytorch, installed oneAPI base toolkits, https://intel.github.io/intel-extension-for-pytorch/index.html#installation?platform=gpu&version=v2.1.30%2bxpu&os=windows&package=pip you don't need install another related library.

please refer #560 , Note: neither “windows powershell” or “anaconda powershell prompt” does not work, if using conda prompt, we need to use "anaconda prompt". open anaconda prompt windows: conda create -n ipex_test python=3.10

conda activate ipex_test

conda install pkg-config libuv # please install it in your conda environment, it is needed. python -m pip install torch==2.1.0.post2 torchvision==0.16.0.post2 torchaudio==2.1.0.post2 intel-extension-for-pytorch==2.1.30 --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/

(ipex_test) C:\Users\test>"C:\Program Files (x86)\Intel\oneAPI\compiler\2024.0\env\vars.bat"

(ipex_test) C:\Users\test>"C:\Program Files (x86)\Intel\oneAPI\mkl\2024.0\env\vars.bat"

(ipex_test) C:\Users\test>python -c "import torch; import torchvision; import torchaudio; import intel_extension_for_pytorch as ipex; print(f'torch_version: {torch.version}'); print(f'torchvision_version: {torchvision.version}'); print(f'torchaudio_version: {torchaudio.version}'); print(f'ipex_version: {ipex.version}');" C:\Users\test\miniconda3\envs\ipex_test\lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: ''If you don't plan on using image functionality from torchvision.io, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have libjpeg or libpng installed before building torchvision from source? warn( torch_version: 2.1.x+cxx11.abi torchvision_version: 0.16.x+cxx11.abi torchaudio_version: 2.1.x+cxx11.abi ipex_version: 2.1.30+xpu

yinghu5 avatar May 10 '24 02:05 yinghu5

also link to #485

yinghu5 avatar May 10 '24 02:05 yinghu5