intel / intel-extension-for-pytorch

A Python package for extending the official PyTorch that can easily obtain performance on Intel platform
Apache License 2.0
1.57k stars 239 forks source link

OSError: [WinError 193] %1 is not a valid win32 application. Error loading "...\intel-ext-pt-gpu.dll" or one of its dependencies. #710

Open 0Pinky0 opened 1 week ago

0Pinky0 commented 1 week ago

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

ZhaoqiongZ commented 6 days ago

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?

0Pinky0 commented 6 days ago

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?

image image

Nuullll commented 4 days ago

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.

ZhaoqiongZ commented 4 days ago

I can also reproduce this issue with python 3.8 on MTL-H, will investigate more