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

Import error with onnxruntime-directml 1.18.1 #21270

Closed
trevortai opened this issue Jul 6, 2024 · 9 comments
Closed

Import error with onnxruntime-directml 1.18.1 #21270

trevortai opened this issue Jul 6, 2024 · 9 comments
Labels
ep:DML issues related to the DirectML execution provider platform:windows issues related to the Windows platform

Comments

@trevortai
Copy link

Describe the issue

I'm encountering a dll load error with onnxruntime-directml 1.18.1 on a Windows11 system:

File "C:\Users\Default\miniconda3\envs\onnx\Lib\site-packages\onnxruntime\capi\_pybind_state.py", line 32, in <module>
    from .onnxruntime_pybind11_state import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: DLL load failed while importing onnxruntime_pybind11_state: A dynamic link library (DLL) initialization routine failed.

Issue is not seen with onnxruntime 1.18.1 or with onnxruntime-directml 1.18.0

To reproduce

  • Install miniconda
  • Open anaconda terminal
conda create -n onnx python -y
conda activate onnx
pip install onnxruntime-directml
python
import onnxruntime

Urgency

Regression in onnxruntime-directml, urgent for users on the latest

Platform

Windows

OS Version

11 Pro Build 22631

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

onnxruntime-directml 1.18.1

ONNX Runtime API

Python

Architecture

X64

Execution Provider

DirectML

Execution Provider Library Version

1.18.1

@github-actions github-actions bot added ep:DML issues related to the DirectML execution provider platform:windows issues related to the Windows platform labels Jul 6, 2024
@Royzxx
Copy link

Royzxx commented Jul 8, 2024

I'm having the exactly same issue. Tried many things but still haven't found a solution yet.

@trevortai
Copy link
Author

I'm having the exactly same issue. Tried many things but still haven't found a solution yet.

Current workaround is to install onnxruntime-directml==1.18.0 instead

@Jay19751103
Copy link

Jay19751103 commented Jul 9, 2024

Previously I install the latest visual studio 17.10.x and build onnxruntime wheel. have this problem to use 17.10.x.
Sometimes when I install msvc-runtime which is build by 17.10.x . it can resolve
I have several conda environments. it sometimes have same issues. Finally I roll back my visual studio to 17.8 to prevent this issue.

@deiteris
Copy link

deiteris commented Jul 15, 2024

Latest release has bumped vcredist requirement to 14.38. Downloading and updating to 14.40 seems to help, but not sure if that's the only required fix. Github runners have 14.40 installed, and builds made with pyinstaller fail with the same problem.

@zhangxiang1993
Copy link
Member

You can try conda install conda-forge::vs2015_runtime

@dongulee
Copy link

dongulee commented Jul 17, 2024

I have encountered a similar issue.
It seems onnxruntime package was built with conflicting dependency of visual c++.

I was using 14.29 vcredist, updating to 14.40 and then, resolved this error.

Refer to https://onnxruntime.ai/docs/install/#requirements

@trevortai
Copy link
Author

You can try conda install conda-forge::vs2015_runtime

I have encountered a similar issue. It seems onnxruntime package was built with conflicting dependency of visual c++.

I was using 14.29 vcredist, updating to 14.40 and then, resolved this error.

Refer to https://onnxruntime.ai/docs/install/#requirements

Thanks, this solved the problem!

@deiteris
Copy link

deiteris commented Jul 17, 2024

You can try conda install conda-forge::vs2015_runtime

In case you use pip, msvc-runtime package also helps (and works with pyinstaller distributions). Thanks for the idea! :D

@meokbodizi
Copy link

wtf.. this issue suffered me for 2 weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ep:DML issues related to the DirectML execution provider platform:windows issues related to the Windows platform
Projects
None yet
Development

No branches or pull requests

7 participants