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

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

Closed
0Pinky0 opened this issue Sep 20, 2024 · 10 comments
Assignees
Labels
ARC ARC GPU Crash Execution crashes Windows

Comments

@0Pinky0
Copy link

0Pinky0 commented Sep 20, 2024

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 ZhaoqiongZ self-assigned this Sep 24, 2024
@ZhaoqiongZ
Copy link
Contributor

ZhaoqiongZ commented Sep 24, 2024

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
Copy link
Author

0Pinky0 commented Sep 24, 2024

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
Copy link

Nuullll commented Sep 26, 2024

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
Copy link
Contributor

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

Nuullll added a commit to intel/AI-Playground that referenced this issue Sep 27, 2024
**Description:**

IPEX 2.3.110+xpu for MTL doesn't work with python 3.11, downgrade to
IPEX 2.1.40+xpu for MTL.

**Related Issue:**

intel/intel-extension-for-pytorch#710

**Checklist:**

- [x] I have tested the changes locally.
- [x] I have self-reviewed the code changes.
- [ ] I have updated the documentation, if necessary.
@0Pinky0
Copy link
Author

0Pinky0 commented Oct 3, 2024

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

@0Pinky0 0Pinky0 closed this as completed Oct 3, 2024
@Nuullll
Copy link

Nuullll commented Oct 9, 2024

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.

@jingxu10 jingxu10 added ARC ARC GPU Crash Execution crashes Windows labels Oct 10, 2024
@0Pinky0
Copy link
Author

0Pinky0 commented Oct 19, 2024

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 #725

@xuhancn
Copy link
Contributor

xuhancn commented Oct 30, 2024

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

@tye1
Copy link

tye1 commented Nov 4, 2024

@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/

@Nuullll
Copy link

Nuullll commented Nov 4, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARC ARC GPU Crash Execution crashes Windows
Projects
None yet
Development

No branches or pull requests

6 participants