onnxruntime: cannot import name 'get_all_providers' - onnx

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!!

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

Related

Importing Open Data set giving attribute error

I am trying to import kaggle datasets using opendatasets module but after using pandas 1.1.2 with python 3.6v it is not working.
It's giving me this error during the import:
AttributeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/opendatasets/utils/network.py in <module>()
7 try:
----> 8 urlopen = urllib.request.urlopen
9 except Exception:
AttributeError: module 'urllib' has no attribute 'request'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last
PS. I'm working on virtual colab files and not on a local machine
Following is the command of what i am doing
import opendatasets as od
dataset_url='https://www.kaggle.com/rohanrao/air-quality-data-in-india'
od.download('https://www.kaggle.com/rohanrao/air-quality-data-in-india')
data_dir = './air-quality-data-in-india'
!pip install jovian opendatasets --upgrade --quiet
!pip install -q kaggle
import urllib.request
import opendatasets as od
and then entering your kaggle username as well as your kaggle key allows you to import the dataset (until and unless it's not opendata set)

Why do I get "No module named Object detection" in Google colab?

I am trying to do object detection using tensor flow in google colab but everytime I run the following code
%run model_builder_test.py
I get this error
ModuleNotFoundError Traceback (most recent call last)
/content/drive2/My Drive/object_detection/builders/model_builder_test.py in <module>()
21
22 from google.protobuf import text_format
---> 23 from object_detection.builders import model_builder
24 from object_detection.meta_architectures import faster_rcnn_meta_arch
25 from object_detection.meta_architectures import rfcn_meta_arch
ModuleNotFoundError: No module named 'object_detection'
I have setup the python path as they said but still keep getting this error.I will give you link to my program below
https://colab.research.google.com/drive/1iko-bEUfxLimtbGqCmrypRyEzaWzE3vu?usp=sharing
Please help
%set_env PYTHONPATH=$PYTHONPATH:/content/models/research:/content/models/research/slim:/content/models
import os
os.environ['PYTHONPATH'] += ':/kaggle/working/models/research/:/kaggle/working/models/research/slim/'

Error while uploading Networkit python module with Jupyter notebook

I installed the Networkit module with conda install -c vgauthier networkit. If I import it in a notebook (import networkit as nk) I get this error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-a4c0096fb06c> in <module>()
----> 1 import networkit as nk
//anaconda/envs/py36/lib/python3.6/site-packages/networkit/__init__.py in <module>()
41 # local imports
42 from . import stopwatch
---> 43 from . import graph
44 from . import graphio
45 from . import community
//anaconda/envs/py36/lib/python3.6/site-packages/networkit/graph.py in <module>()
1 # extension imports
----> 2 from _NetworKit import Graph, SpanningForest, GraphTools, RandomMaximumSpanningForest, UnionMaximumSpanningForest
ImportError: dlopen(//anaconda/envs/py36/lib/python3.6/site-packages/_NetworKit.cpython-36m-darwin.so, 2): Library not loaded: #rpath/libomp.dylib
Referenced from: //anaconda/envs/py36/lib/python3.6/site-packages/_NetworKit.cpython-36m-darwin.so
Reason: image not found
Anyone able to explain why?
​
I happened to have the same problem for networkit via pip. It is because the networkit installed by anaconda does not link to your gcc compiler correctly, a simple fix is to download the networkit's source code and run python3 setup.py install to install it.
I had the same problem:
https://github.com/kit-parco/networkit/issues/172
It's because of anaconda Python. Re-install it using:
conda install -c vgauthier networkit
installing it with conda instead of pip solved the problem for me. See instructions here.

pandas_datareader not working in jupyter-notebook (Anaconda)

ModuleNotFoundError Traceback (most recent call last)
in ()
3 from matplotlib import style
4 import pandas as pd
----> 5 import pandas_datareader.data as web
6
7 style.use('ggplot')
ModuleNotFoundError: No module named 'pandas_datareader'
data reader gotta be installed separetly.
if using anacoda, try:
conda install -c https://conda.anaconda.org/anaconda pandas-datareader

ImportError: cannot import name 'init_osx_clipboard'

Using pandas 0.19.2 on Linux Mint 18
When I copy any table from Libre Calc / MS Excel and run
df = pd.read_clipboard()
I get:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-7-6dead334eb54> in <module>()
----> 1 df = pd.read_clipboard()
/home/prashant/anaconda3/lib/python3.6/site-packages/pandas/io/clipboard.py in read_clipboard(**kwargs)
23 'reading from clipboard only supports utf-8 encoding')
24
---> 25 from pandas.util.clipboard import clipboard_get
26 from pandas.io.parsers import read_table
27 text = clipboard_get()
/home/prashant/anaconda3/lib/python3.6/site-packages/pandas/util/clipboard/__init__.py in <module>()
31 import os
32 import subprocess
---> 33 from .clipboards import (init_osx_clipboard,
34 init_gtk_clipboard, init_qt_clipboard,
35 init_xclip_clipboard, init_xsel_clipboard,
ImportError: cannot import name 'init_osx_clipboard'
How to resolve this?
Thanks in Advance.
The clipboard documentation may shed some light on your issue, given that you're running on Linux:
On Linux, install xclip or xsel via package manager.
For example, in Debian:
sudo apt-get install xclip
Otherwise on Linux, you will need the gtk or PyQt4 modules installed.
gtk and PyQt4 modules are not available for Python 3,
and this module does not work with PyGObject yet.

Resources