-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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' #3943
Comments
Can you do this in a clean environment (possibly using conda)? The error seems to be pretty clear - Error: 'Python version |
@pranavsharma Thank you for your quick reply, really appreciate that.. i'm using a virtualenv environment with python 3.6.6..Do we have some debug methods to check where python 3.5 involved during the building process? |
I was able to repro this in my py36 venv. I've 3.5.2 outside the venv and 3.6.10 inside.
|
is this a PATH issue? Is it finding python 3.5 before 3.6? |
Yes, it was using 3.5 libs even though both 3.5 and 3.6 libs are present in the same dir (/usr/lib/x86_64-linux-gnu/). I retried in a new terminal window and can't seem to repro it anymore. |
@manofmountain any more questions? Does this resolve your issue? |
plz reopen if this doesn't resolve. |
Describe the bug
Manually build onnxruntime with python wheel and encounter such an issue while launching related python test at the end of the building process.
Urgency
M
System information
To Reproduce
my source build command is: ./build.sh --config Debug --build_shared_lib --parallel --build_wheel
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
when I import onnxruntime ,Error is follow: (BTW, i definitely activate python 3.6.6 before the source building.
2020-05-15 00:32:40,450 Build [DEBUG] - Running subprocess in '/home/lshusen/onnxruntime/build/Linux/Debug'
['/home/lshusen/workspace/py36/bin/python3', 'onnxruntime_test_python.py']
/mnt/ssd/lshusen/onnxruntime/build/Linux/Debug/onnxruntime/capi/_pybind_state.py:13: UserWarning: Cannot load onnxruntime.capi. Error: 'Python version
mismatch: module was compiled for Python 3.5, but the interpreter version is incompatible: 3.6.6 (default, Apr 18 2020, 18:55:01)
[GCC 5.4.0 20160609].'
warnings.warn("Cannot load onnxruntime.capi. Error: '{0}'".format(str(e)))
Traceback (most recent call last):
File "onnxruntime_test_python.py", line 8, in
import onnxruntime as onnxrt
File "/mnt/ssd/lshusen/onnxruntime/build/Linux/Debug/onnxruntime/init.py", line 12, in
from onnxruntime.capi._pybind_state import get_all_providers, get_available_providers, get_device, set_seed, RunOptions, SessionOptions, set_defaul
t_logger_severity, NodeArg, ModelMetadata, GraphOptimizationLevel, ExecutionMode, OrtDevice, SessionIOBinding
ImportError: cannot import name 'get_all_providers'
Traceback (most recent call last):
File "/home/lshusen/onnxruntime/tools/ci_build/build.py", line 1740, in
sys.exit(main())
File "/home/lshusen/onnxruntime/tools/ci_build/build.py", line 1640, in main
args.use_tvm, args.use_tensorrt)
File "/home/lshusen/onnxruntime/tools/ci_build/build.py", line 1102, in run_onnxruntime_tests
cwd=cwd, dll_path=dll_path)
File "/home/lshusen/onnxruntime/tools/ci_build/build.py", line 391, in run_subprocess
env=my_env, shell=shell)
File "/home/lshusen/bin/lib/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/home/lshusen/workspace/py36/bin/python3', 'onnxruntime_test_python.py']' returned non-zero exit status 1.
(py36) ➜ /home/lshusen/onnxruntime (rel-1.3.0) vim build.log
The text was updated successfully, but these errors were encountered: