0

I have installed onnxruntime-gpu library in my environment

pip install onnxruntime-gpu==1.2.0

nvcc --version output
Cuda compilation tools, release 10.1, V10.1.105

>>> import onnxruntime
C:\Users\abgangwa\AppData\Local\Continuum\anaconda3\envs\onnx_gpu\lib\site-packages\onnxruntime\capi\_pybind_state.py:13: UserWarning: Cannot load onnxruntime.capi. Error: 'DLL load failed: The specified module could not be found.'
  warnings.warn("Cannot load onnxruntime.capi. Error: '{0}'".format(str(e)))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\abgangwa\AppData\Local\Continuum\anaconda3\envs\onnx_gpu\lib\site-packages\onnxruntime\__init__.py", line 12, in <module>
    from onnxruntime.capi._pybind_state import get_all_providers, get_available_providers, get_device, RunOptions, SessionOptions, set_default_logger_severity, NodeArg, ModelMetadata, GraphOptimizationLevel, ExecutionMode
ImportError: cannot import name 'get_all_providers'

Please help me to resolve this error

Tried existing solutions. none of them worked

Abhishek Gangwar
  • 1,697
  • 3
  • 17
  • 29

2 Answers2

2

Just install the Suitable version :

pip install onnxruntime #for CPU-only

pip install onnxruntime-gpu #For GPU

  • Welcome to Stack Overflow. Can you explain how that solves the issue that is described in the question? – Maurice Schleußinger Dec 14 '22 at 17:06
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 14 '22 at 17:07
0

Most likely the CUDA dlls aren't in the path so aren't found when the onnxruntime library is being loaded by python.

This reply has a link to an article regarding fixing this.

https://github.com/microsoft/onnxruntime/issues/4196#issuecomment-808787338

Scott McKay
  • 190
  • 1
  • 8