microsoft / onnxruntime-genai

Generative AI extensions for onnxruntime
MIT License
444 stars 105 forks source link

[DirectML] [v0.3.0] Dynamic link library not found. #657

Closed tjtanaa closed 3 months ago

tjtanaa commented 3 months ago

Issue:

Traceback (most recent call last):
  File "C:\Users\ryzz\git\phi3-qa.py", line 1, in <module>
    import onnxruntime_genai as og
  File "C:\Users\ryzz\anaconda3\envs\onnxdml\lib\site-packages\onnxruntime_genai\__init__.py", line 20, in <module>
    raise e
  File "C:\Users\ryzz\anaconda3\envs\onnxdml\lib\site-packages\onnxruntime_genai\__init__.py", line 10, in <module>
    from onnxruntime_genai.onnxruntime_genai import *
ImportError: DLL load failed while importing onnxruntime_genai: A dynamic link library (DLL) initialization routine failed.

Reproduce Steps

  1. conda create -n onnxdml python=3.10
  2. conda activate onnxdml
  3. pip install onnxruntime-genai-directml
  4. Follow the example at https://onnxruntime.ai/docs/genai/tutorials/phi3-python.html#run-with-directml .
baijumeswani commented 3 months ago

This is a known issue. My guess is that you're using conda on Windows?

Please see this issue for more details: https://github.com/microsoft/onnxruntime-genai/issues/555

TLDR: run conda install conda-forge::vs2015_runtime should fix the issue.

natke commented 3 months ago

@tjtanaa Please let us know if the above workaround fixes the issue

natke commented 3 months ago

Workaround is documented here: https://onnxruntime.ai/docs/genai/howto/troubleshoot.html#windows-conda-import-error

tjtanaa commented 3 months ago

This is a known issue. My guess is that you're using conda on Windows?

Please see this issue for more details: #555

TLDR: run conda install conda-forge::vs2015_runtime should fix the issue.

Thank you very much. This resolves the issue.