OSError: [WinError 193] %1 is not a valid win32 application. Error loading "...\intel-ext-pt-gpu.dll" or one of its dependencies.
Describe the bug
I installed ipex==2.3.110+xpu on Windows11 following official instructions, and got [WinError 193] when importing ipex.
Traceback (most recent call last):
File "D:\Projects\open-competition-2024-4\tests\test_ipex.py", line 2, in <module>
import intel_extension_for_pytorch as ipex
File "C:\Users\abc\miniforge3\envs\py38\lib\site-packages\intel_extension_for_pytorch\__init__.py", line 107, in <module>
raise err
OSError: [WinError 193] %1 is not a valid win32 application. Error loading "C:\Users\abc\miniforge3\envs\py38\lib\site-packages\intel_extension_for_pytorch\bin\intel-ext-pt-gpu.dll" or one of its dependencies.
The python 3.8 environment was created with Miniforge3-24.7.1; OneApi was not installed since it was not mentioned in installation documents.
Versions
PyTorch version: 2.3.1+cxx11.abi PyTorch CXX11 ABI: No IPEX version: N/A IPEX commit: N/A Build type: N/A
OS: Microsoft Windows 11 家庭中文版 GCC version: N/A Clang version: N/A IGC version: N/A CMake version: N/A Libc version: N/A
Python version: 3.8.19 (default, Mar 20 2024, 19:55:45) [MSC v.1916 64 bit (AMD64)] (64-bit runtime) Python platform: Windows-10-10.0.22631-SP0 Is XPU available: N/A DPCPP runtime version: N/A MKL version: N/A GPU models and configuration: N/A Intel OpenCL ICD version: N/A Level Zero version: N/A
CPU: Architecture=9 CurrentClockSpeed=1400 DeviceID=CPU0 Family=774 L2CacheSize=18432 L2CacheSpeed= Manufacturer=GenuineIntel MaxClockSpeed=1400 Name=Intel(R) Core(TM) Ultra 7 155H ProcessorType=3 Revision=
Versions of relevant libraries: [pip3] intel_extension_for_pytorch==2.3.110+xpu [pip3] numpy==1.24.4 [pip3] torch==2.3.1+cxx11.abi [conda] intel-extension-for-pytorch 2.3.110+xpu pypi_0 pypi [conda] mkl 2024.2.1 pypi_0 pypi [conda] mkl-dpcpp 2024.2.1 pypi_0 pypi [conda] numpy 1.24.4 pypi_0 pypi [conda] onemkl-sycl-blas 2024.2.1 pypi_0 pypi [conda] onemkl-sycl-datafitting 2024.2.1 pypi_0 pypi [conda] onemkl-sycl-dft 2024.2.1 pypi_0 pypi [conda] onemkl-sycl-lapack 2024.2.1 pypi_0 pypi [conda] onemkl-sycl-rng 2024.2.1 pypi_0 pypi [conda] onemkl-sycl-sparse 2024.2.1 pypi_0 pypi [conda] onemkl-sycl-stats 2024.2.1 pypi_0 pypi [conda] onemkl-sycl-vm 2024.2.1 pypi_0 pypi [conda] torch 2.3.1+cxx11.abi pypi_0 pypi
Hi @0Pinky0 , thanks for reporting it, I follow the installation guide in my side on Arc and work properly. all the required oneapi packages have been installed as dependencies while installing ipex. so no need to install oneapi for v2.3.110+xpu. Could you please offer your hardware info and driver version info?
Hi @0Pinky0 , thanks for reporting it, I follow the installation guide in my side on Arc and work properly. all the required oneapi packages have been installed as dependencies while installing ipex. so no need to install oneapi for v2.3.110+xpu. Could you please offer your hardware info and driver version info?
Processor: Intel® Core™ Ultra 7 155H Graphics: Intel® Arc™ Graphics Driver version: 32.0.101.6078
Python platform: Windows-10-10.0.22631-SP0 Python version: 3.8.19 (default, Mar 20 2024, 19:55:45) [MSC v.1916 64 bit (AMD64)] (64-bit runtime) Python virtual environment manager: Miniforge3-24.7.1
I tried to create python 3.9 and 3.10 virtual envs and install ipex==2.3.110+xpu following the same process; In the python 3.10 environment I can properly import ipex and run throught sanity check, but in the python 3.9 environment I got the same error. Maybe this is related to virtual env manager or python version?
I can confirm this issue happening with python 3.11 for MTL iGPU.
python -c "import torch; import intel_extension_for_pytorch as ipex; print(torch.__version__); print(ipex.__version__); [print(f'[{i}]: {torch.xpu.get_device_properties(i)}') for i in range(torch.xpu.device_count())];"
D:\iusers\yilonggu\conda_envs\tmp311\Lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: 'Could not find module 'D:\iusers\yilonggu\conda_envs\tmp311\Lib\site-packages\torchvision\image.pyd' (or one of its dependencies). Try using the full path with constructor syntax.'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(
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\iusers\yilonggu\conda_envs\tmp311\Lib\site-packages\intel_extension_for_pytorch\__init__.py", line 107, in <module>
raise err
OSError: [WinError 193] %1 is not a valid Win32 application. Error loading "D:\iusers\yilonggu\conda_envs\tmp311\Lib\site-packages\intel_extension_for_pytorch\bin\intel-ext-pt-gpu.dll" or one of its dependencies.
Python 3.10 works fine.
I can also reproduce this issue with python 3.8 on MTL-H, will investigate more
I just noticed that there's a new distribution for Ultra Series 2 with Intel® Arc™ Graphics in official installation guide, and it did help me run through sanity check in Python 3.8: https://intel.github.io/intel-extension-for-pytorch/index.html#installation?platform=gpu&version=v2.3.110%2bxpu&os=windows&package=pip
I just noticed that there's a new distribution for Ultra Series 2 with Intel® Arc™ Graphics in official installation guide, and it did help me run through sanity check in Python 3.8: https://intel.github.io/intel-extension-for-pytorch/index.html#installation?platform=gpu&version=v2.3.110%2bxpu&os=windows&package=pip
That was optimized for Intel® Core™ Ultra 2XX processor. Using it with Intel® Core™ Ultra 7 155H may be problematic: you may experience a long warmup (JIT compilation) time before inference starts. Sanity check doesn't expose this issue.
I just noticed that there's a new distribution for Ultra Series 2 with Intel® Arc™ Graphics in official installation guide, and it did help me run through sanity check in Python 3.8: https://intel.github.io/intel-extension-for-pytorch/index.html#installation?platform=gpu&version=v2.3.110%2bxpu&os=windows&package=pip
That was optimized for Intel® Core™ Ultra 2XX processor. Using it with Intel® Core™ Ultra 7 155H may be problematic: you may experience a long warmup (JIT compilation) time before inference starts. Sanity check doesn't expose this issue.
This is indeed a big problem what I am facing https://github.com/intel/intel-extension-for-pytorch/issues/725
Hi @0Pinky0 could you please try to enable long path support on Windows, and validate it?
Steps: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#registry-setting-to-enable-long-paths
@0Pinky0 could you please verify if IPEX v2.3.110 hotfix patch resolves your issue?
please refer to the installation guide: https://intel.github.io/intel-extension-for-pytorch/index.html#installation?platform=gpu&version=v2.3.110%2bxpu&os=windows&package=pip.
For Intel® Arc™ A-Series Graphics, use the commands below:
conda install libuv python -m pip install torch==2.3.1.post0+cxx11.abi torchvision==0.18.1.post0+cxx11.abi torchaudio==2.3.1.post0+cxx11.abi intel-extension-for-pytorch==2.3.110.post0+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/
For Intel® Core™ Ultra Processors with Intel® Core™ Ultra Processors with Intel® Arc™ Graphics (MTL-H), use the commands below:
conda install libuv python -m pip install torch==2.3.1.post0+cxx11.abi torchvision==0.18.1.post0+cxx11.abi torchaudio==2.3.1.post0+cxx11.abi intel-extension-for-pytorch==2.3.110.post0+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/mtl/us/
For Intel® Core™ Ultra Series 2 with Intel® Arc™ Graphics, use the commands below:
conda install libuv python -m pip install torch==2.3.1.post0+cxx11.abi torchvision==0.18.1.post0+cxx11.abi torchaudio==2.3.1.post0+cxx11.abi intel-extension-for-pytorch==2.3.110.post0+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/lnl/us/
The issue is gone for me with 2.3.110 hotfix! Thank you!
conda create -n mtl311 python=3.11 libuv -y
conda activate mtl311
python -m pip install torch==2.3.1.post0+cxx11.abi torchvision==0.18.1.post0+cxx11.abi torchaudio==2.3.1.post0+cxx11.abi intel-extension-for-pytorch==2.3.110.post0+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/mtl/us/
python -c "import torch; import intel_extension_for_pytorch as ipex; print(torch.__version__); print(ipex.__version__); [print(f'[{i}]: {torch.xpu.get_device_properties(i)}') for i in range(torch.xpu.device_count())];"
D:\iusers\yilonggu\conda_envs\mtl311\Lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: 'Could not find module 'D:\iusers\yilonggu\conda_envs\mtl311\Lib\site-packages\torchvision\image.pyd' (or one of its dependencies). Try using the full path with constructor syntax.'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(
D:\iusers\yilonggu\conda_envs\mtl311\Lib\site-packages\intel_extension_for_pytorch\llm\__init__.py:9: UserWarning: failed to use huggingface generation fuctions due to: No module named 'transformers'.
warnings.warn(f"failed to use huggingface generation fuctions due to: {e}.")
2.3.1.post0+cxx11.abi
2.3.110.post0+xpu
[0]: _XpuDeviceProperties(name='Intel(R) Arc(TM) Graphics', platform_name='Intel(R) Level-Zero', type='gpu', driver_version='1.3.29283', total_memory=14765MB, max_compute_units=112, gpu_eu_count=112, gpu_subslice_count=14, max_work_group_size=1024, max_num_sub_groups=128, sub_group_sizes=[8 16 32], has_fp16=1, has_fp64=1, has_atomic64=1)