onnxruntime: cannot import name 'get_all_providers'

2k views Asked by At

Trying to import onnxruntime in a Jupiter notebook with python 3.6.3 on macOS. I get the following error on import:

import onnxruntime


ImportError                               
Traceback (most recent call last)
<ipython-input-4-df664b79ebd4> in <module>
----> 1 import onnxruntime
      2 

~/.virtualenvs/3.6nlp/lib/python3.6/site-packages/onnxruntime/__init__.py in <module>
     11 __author__ = "Microsoft"
     12 
---> 13 from onnxruntime.capi._pybind_state import get_all_providers, get_available_providers, get_device, set_seed, \
     14     RunOptions, SessionOptions, set_default_logger_severity, NodeArg, ModelMetadata, GraphOptimizationLevel, \
     15     ExecutionMode, OrtDevice, SessionIOBinding

ImportError: cannot import name 'get_all_providers'

I have looked at similar questions such as this but haven't found the answer that works for me.

Any suggestions? Thanks!!

1

There are 1 answers

0
Fab On

It turns out the issue is with libomp not being installed. If you run into this problem you can solve it by running

brew install libomp

Hope this helps if you get stuck like me