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 onnxruntime Error:cannot import name 'get_all_providers' #2572

Closed
verigle opened this issue Dec 6, 2019 · 2 comments
Closed

import onnxruntime Error:cannot import name 'get_all_providers' #2572

verigle opened this issue Dec 6, 2019 · 2 comments

Comments

@verigle
Copy link

verigle commented Dec 6, 2019

Describe the bug
A clear and concise description of what the bug is.

Urgency
If there are particular important use cases blocked by this or strict project-related timelines, please share more information and dates. If there are no hard deadlines, please specify none.

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 18.04
  • ONNX Runtime installed from (source or binary):source
  • ONNX Runtime version:1.0
  • Python version:3.7
  • Visual Studio version (if applicable):
  • GCC/Compiler version (if compiling from source):7.4
  • CUDA/cuDNN version:10.1/7
  • GPU model and memory:4G

To Reproduce
Describe steps/code to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here. If the issue is about a particular model, please share the model details as well to facilitate debugging.

when I import onnxruntime ,Error is follow:

Python 3.7.5 (default, Oct 25 2019, 15:51:11)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

import onnxruntime
/home/verigle/miniconda3/envs/pytorch/lib/python3.7/site-packages/onnxruntime/capi/_pybind_state.py:13: UserWarning: Cannot load onnxruntime.capi. Error: 'Python version mismatch: module was compiled for Python 3.6, but the interpreter version is incompatible: 3.7.5 (default, Oct 25 2019, 15:51:11)
[GCC 7.3.0].'
warnings.warn("Cannot load onnxruntime.capi. Error: '{0}'".format(str(e)))
Traceback (most recent call last):
File "", line 1, in
File "/home/verigle/miniconda3/envs/pytorch/lib/python3.7/site-packages/onnxruntime/init.py", line 12, in
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' from 'onnxruntime.capi._pybind_state' (/home/verigle/miniconda3/envs/pytorch/lib/python3.7/site-packages/onnxruntime/capi/_pybind_state.py)

@jywu-msft
Copy link
Member

the error message indicates the reason:
/home/verigle/miniconda3/envs/pytorch/lib/python3.7/site-packages/onnxruntime/capi/_pybind_state.py:13: UserWarning: Cannot load onnxruntime.capi. Error: 'Python version mismatch: module was compiled for Python 3.6, but the interpreter version is incompatible: 3.7.5 (default, Oct 25 2019, 15:51:11)

you're using a version of onnxruntime built for python 3.6 ,
but it looks like your conda environment is python 3.7
did you build onnxruntime from source? if you want to use python 3.7 , make sure the python lib for 3.7 is in your path. instead it is finding python 3.6 during build.
Try activating your python 3.7 environment prior to building?
(or try running onnxruntime using the python 3.6 that was used to build it rather than in the python 3.7 conda environment)

@verigle
Copy link
Author

verigle commented Dec 6, 2019

yes,I build onnxruntime from source used system default python of version 3.6.I will activating your python 3.7 environment prior to building.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants