Skip to content

Cryptic message while importing CUDA version of onnxruntime Python package when one of dependencies is missing #6435

Description

@ivanst0

Describe the bug
If one of native dependencies of onnxruntime-gpu package (CUDA, cuDNN, C++ Runtime) is missing the following error message is printed before the process terminates:

<python_env>\lib\site-packages\onnxruntime\capi\_pybind_state.py:14: 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 "<string>", line 1, in <module>
  File "<python_env>\lib\site-packages\onnxruntime\__init__.py", line 13, in <module>
    from onnxruntime.capi._pybind_state import get_all_providers, get_available_providers, get_device, set_seed, \
ImportError: cannot import name 'get_all_providers' from 'onnxruntime.capi._pybind_state' (<python_env>\lib\site-packages\onnxruntime\capi\_pybind_state.py)

Based on this message the user can't figure out which dependency is missing, or which version of particular dependency is required.

System information

  • OS Platform and Distribution: Windows 10
  • ONNX Runtime installed from: PyPI
  • ONNX Runtime version: 1.6.0
  • Python version: any

Expected behavior
The error message should inform the user which dependency is missing (and which version of it).

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestrequest for unsupported feature or enhancement

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions