Can't import torch
Describe the issue
I faced this issue when I was trying to use the extension, error:
Traceback (most recent call last):
File "C:\kanemoto\vscode\llm\main.py", line 1, in <module>
import torch
File "C:\Users\kanemoto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\torch\__init__.py", line 139, in <module>
raise err
OSError: [WinError 126] The specified module could not be found. Error loading "C:\Users\kanemoto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\torch\lib\backend_with_compiler.dll" or one of its dependencies.
The command I used to install(from the docs):
python -m pip install torch==2.1.0.post3 torchvision==0.16.0.post3 torchaudio==2.1.0.post3 intel-extension-for-pytorch==2.1.40+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/cn/
My code:
import torch
import intel_extension_for_pytorch as ipex
I am using A770 16GB.
And yes, the backend_with_compiler.dll exists in the path.
I have the latest Microsoft Visual C++ Redistributable installed.
Hi @AlphastT101 , did you run conda install pkg-config libuv as described in the installation guide? And don't forget to install oneapi base toolkit also.
Hi @AlphastT101 , did you run
conda install pkg-config libuvas described in the installation guide? And don't forget to install oneapi base toolkit also.
Yeah, I ran that, and I also have OneAPI installed.
By the way, I used a fork from this repository, and it works perfect, super easy to set up. It doesn’t require OneAPI or the conda package. However, I would like to use the official package from Intel. Plus, the OneAPI is taking too much space, 15GB.
What's the version of your oneAPI base toolkit?
You can try below in your conda environment and let me know whether it works or not.
pip install mkl-dpcpp dpcpp-cpp-rt
pip install numpy==1.26.4
In the upcoming 2.3.110 release on Windows, you don't need to install oneAPI separately. Please keep tuned.
IPEX 2.3.110 windows wheels for ARC770 are publicly available, please refer to https://intel.github.io/intel-extension-for-pytorch/index.html#installation?platform=gpu&version=v2.3.110%2bxpu&os=windows&package=pip