ImportError: cannot import name 'init_osx_clipboard' - linux

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.

Related

while attempting to import module of sklearn in Jupiter notebook as well as in PYCHARM, i continuously get following error

i have installed scikit-learn using pip command, however while trying to import module of sklearn in Jupiter notebook as well as in PYCHARM, i continuously get following error. I am working in python3.9. I am new to the interface, so it is requested to suggest solution for this issue.
ImportError Traceback (most recent call last)
in
----> 1 import sklearn.linear_model as lm
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/init.py in
79 # it and importing it first would fail if the OpenMP dll cannot be found.
80 from . import _distributor_init # noqa: F401
---> 81 from . import __check_build # noqa: F401
82 from .base import clone
83 from .utils._show_versions import show_versions
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/init.py in
44 from ._check_build import check_build # noqa
45 except ImportError as e:
---> 46 raise_build_error(e)
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/init.py in raise_build_error(e)
29 else:
30 dir_content.append(filename + '\n')
---> 31 raise ImportError("""%s
32 ___________________________________________________________________________
33 Contents of %s:
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/_check_build.cpython-39-darwin.so, 2): Symbol not found: ____chkstk_darwin
Referenced from: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/../.dylibs/libomp.dylib
Expected in: /usr/lib/libSystem.B.dylib
in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/../.dylibs/libomp.dylib
Contents of /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build:
init.py pycache _check_build.cpython-39-darwin.so
setup.py
It seems that scikit-learn has not been built correctly.
If you have installed scikit-learn from source, please do not forget
to build the package before using it: run python setup.py install or
make in the source directory.
If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform
thanks
As you can see in this bug report, the new sklearn version 0.24 crashes on MacOS<10.15 systems.
Until this bug is fixed, the developers suggest installing the previous version using pip install -U scikit-learn==0.23.

onnxruntime: cannot import name 'get_all_providers'

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

ImportError: No module named 'sklearn.__check_build._check_build'

ModuleNotFoundError Traceback (most recent call last)
~\AppData\Roaming\Python\Python36\site-packages\sklearn\__check_build\__init__.py in <module>()
43 try:
---> 44 from ._check_build import check_build # noqa
45 except ImportError as e:
ModuleNotFoundError: No module named
'sklearn.__check_build._check_build'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-1-f14d678f34eb> in <module>()
1 from keras.models import Sequential
2 from keras.layers import Dense, Dropout
----> 3 from sklearn.model_selection import train_test_split
4 import numpy
5 import pandas as pd
~\AppData\Roaming\Python\Python36\site-packages\sklearn\__init__.py in <module>()
61 # process, as it may not be compiled yet
62 else:
---> 63 from . import __check_build
64 from .base import clone
65 from .utils._show_versions import show_versions
~\AppData\Roaming\Python\Python36\site-packages\sklearn\__check_build\__init__.py in <module>()
44 from ._check_build import check_build # noqa
45 except ImportError as e:
---> 46 raise_build_error(e)
~\AppData\Roaming\Python\Python36\site-packages\sklearn\__check_build\__init__.py in raise_build_error(e)
39 to build the package before using it: run `python setup.py install` or
40 `make` in the source directory.
---> 41 %s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
42
43 try:
ImportError: No module named 'sklearn.__check_build._check_build'
Contents of C:\Users\owaisaaa\AppData\Roaming\Python\Python36\site-packages\sklearn\__check_build:
setup.py _check_build.cp36-win32.pyd__init__.py
__pycache__
It seems that scikit-learn has not been built correctly.
If you have installed scikit-learn from source, please do not forget
to build the package before using it: run python setup.py install or
make in the source directory.
If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.
I recently used the pycharm on the same machine and downloaded the packages in it. From that moment onward I am getting the above mentioned error in my jupyter notebook.
Try installing scipy and restarting python shell
Upgrading scikit-learn worked for me:
$ pip install --upgrade scikit-learn

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.

Using pytables with python3 fails

importing pytables (3.1.1) in python 3.4.1 fails for me, complaining about a failed cPickle import
i try to use potables (3.1.1) with python (3.4.1)
In [1]: import tables
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-389ecae14f10> in <module>()
----> 1 import tables
/work/projects/vEnv/lib/python3.4/site-packages/tables/__init__.py in <module>()
80
81 # Necessary imports to get versions stored on the cython extension
---> 82 from tables.utilsextension import (
83 get_pytables_version, get_hdf5_version, blosc_compressor_list,
84 blosc_compcode_to_compname_ as blosc_compcode_to_compname,
/work/projects/vEnv/lib/python3.4/site-packages/tables/utilsextension.pyx in init tables.utilsextension (tables/utilsextension.c:15600)()
/work/projects/vEnv/lib/python3.4/site-packages/tables/description.py in <module>()
22 import numpy
23
---> 24 from tables import atom
25 from tables.path import check_name_validity
26
/work/projects/vEnv/lib/python3.4/site-packages/tables/atom.py in <module>()
18 import sys
19 import inspect
---> 20 import cPickle
21
22 import numpy
As i understand cPickle is only used instead of pickle in python2.
As of PyTable 3.x it should work fine with python3.x. How can there be a cPickle import than?
What do i have to do to use pytables with python3?
The error was produced most likely due to a problem with my vEnv. Uninstalling the package and reinstalling it fix the problem.
See github issue

Resources