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

onnxruntime-directml import interference with sklearn #21724

Open
xcmgttacct opened this issue Aug 13, 2024 · 1 comment
Open

onnxruntime-directml import interference with sklearn #21724

xcmgttacct opened this issue Aug 13, 2024 · 1 comment
Labels
ep:DML issues related to the DirectML execution provider

Comments

@xcmgttacct
Copy link

Describe the issue

There is a weird bug when working with sklearn and onnxruntime-directml. When running natively with python, if the sklearn is imported before onnxruntime, the onnxruntime will throw DLL load failed exception:

...\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.

This behavior can be fixed by import onnxruntime first. However, in pyinstaller packed executable, rearrange the import order does not fix the issues.

To reproduce

A simple script to reproduce, the code below will throw exception:

import numpy
import sklearn
import onnxruntime

print(onnxruntime.__version__)

The code below works:

import numpy
import onnxruntime
import sklearn

print(onnxruntime.__version__)

Urgency

No response

Platform

Windows

OS Version

11 (Build number) 22631.3880)

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.18.1

ONNX Runtime API

Python

Architecture

X64

Execution Provider

DirectML

Execution Provider Library Version

No response

@github-actions github-actions bot added the ep:DML issues related to the DirectML execution provider label Aug 13, 2024
@bluceliuljx
Copy link

image
ImportError: DLL load failed while importing onnxruntime_pybind11_state: 动态链接库(DLL)初始化例程失败。

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
Projects
None yet
Development

No branches or pull requests

2 participants