import matplotlib.pyplot as plt - KeyError: 'keymap.quit_all' - python-3.x

import matplotlib.pyplot as plt
When I enter the code above, I get the following error
#( conda install matplotlib/ python 3.5.2/ anaconda 3.4.2 / window10)
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-19-eff513f636fd> in <module>()
----> 1 import matplotlib.pyplot as plt
C:\Users\kimjimin\Anaconda3\lib\site-packages\matplotlib\pyplot.py in <module>()
36 from matplotlib.cbook import deprecated, warn_deprecated
37 from matplotlib import docstring
---> 38 from matplotlib.backend_bases import FigureCanvasBase
39 from matplotlib.figure import Figure, figaspect
40 from matplotlib.gridspec import GridSpec
C:\Users\kimjimin\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in <module>()
51 import numpy as np
52
---> 53 from matplotlib import (
54 backend_tools as tools, cbook, colors, textpath, tight_bbox, transforms,
55 widgets, get_backend, is_interactive, rcParams)
C:\Users\kimjimin\Anaconda3\lib\site-packages\matplotlib\backend_tools.py in <module>()
389
390
--> 391 class ToolQuitAll(ToolBase):
392 """Tool to call the figure manager destroy method"""
393
C:\Users\kimjimin\Anaconda3\lib\site-packages\matplotlib\backend_tools.py in ToolQuitAll()
393
394 description = 'Quit all figures'
--> 395 default_keymap = rcParams['keymap.quit_all']
396
397 def trigger(self, sender, event, data=None):
C:\Users\kimjimin\Anaconda3\lib\site-packages\matplotlib\__init__.py in __getitem__(self, key)
904 val = alt_val(val)
905 elif key in _deprecated_set and val is not None:
--> 906 if key.startswith('backend'):
907 warnings.warn(self.msg_backend_obsolete.format(key),
908 mplDeprecation)
KeyError: 'keymap.quit_all'

Related

Cannot load backend 'Qt5Agg' or it doesn't show any plot

I'm trying to use 'Qt5Agg' matplotlib backend in Jupyter , but when I run %matplotlib qt, i get the following error:
ImportError Traceback (most recent call last)
<ipython-input-1-f6a92ad1c7f8> in <module>
----> 1 get_ipython().run_line_magic('matplotlib', 'qt')
2 import numpy as np
3 from scipy.integrate import odeint
4 import matplotlib.pyplot as plt
5 from mpl_toolkits.mplot3d import Axes3D
~/.local/lib/python3.5/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
2312 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2313 with self.builtin_trap:
-> 2314 result = fn(*args, **kwargs)
2315 return result
2316
</home/cs/.local/lib/python3.5/site-packages/decorator.py:decorator-gen-108> in matplotlib(self, line)
~/.local/lib/python3.5/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):
~/.local/lib/python3.5/site-packages/IPython/core/magics/pylab.py in matplotlib(self, line)
97 print("Available matplotlib backends: %s" % backends_list)
98 else:
---> 99 gui, backend = self.shell.enable_matplotlib(args.gui.lower() if isinstance(args.gui, str) else args.gui)
100 self._show_matplotlib_backend(args.gui, backend)
101
~/.local/lib/python3.5/site-packages/IPython/core/interactiveshell.py in enable_matplotlib(self, gui)
3412 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select)
3413
-> 3414 pt.activate_matplotlib(backend)
3415 pt.configure_inline_support(self, backend)
3416
~/.local/lib/python3.5/site-packages/IPython/core/pylabtools.py in activate_matplotlib(backend)
312
313 import matplotlib.pyplot
--> 314 matplotlib.pyplot.switch_backend(backend)
315
316 # This must be imported last in the matplotlib series, after
~/.local/lib/python3.5/site-packages/matplotlib/pyplot.py in switch_backend(newbackend)
220 "Cannot load backend {!r} which requires the {!r} interactive "
221 "framework, as {!r} is currently running".format(
--> 222 newbackend, required_framework, current_framework))
223
224 rcParams['backend'] = rcParamsDefault['backend'] = newbackend
ImportError: Cannot load backend 'Qt5Agg' which requires the 'qt5' interactive framework, as 'headless' is currently running
I tried running first:
import matplotlib
matplotlib.use('Qt5Agg')
but if i run again %matplotlib qt, i'm getting the same error.
If i don't run the magic command, and i plot something, it doesn't show anything.

How can I eliminate "UnpicklingError: invalid load key, '\x00'" in win32com?

I'm using the latest version of win32com on Windows 7 and Python 3.6. import win32com.client working fine until recently. I'm now getting an UnpicklingError exception.
I've tried reinstalling the latest version globally as well as in a separate virtual environment.
In [1]: import win32com.client
---------------------------------------------------------------------------
UnpicklingError Traceback (most recent call last)
<ipython-input-1-acfbed532f32> in <module>()
----> 1 import win32com.client
C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\__init__.py in <module>()
9 import pythoncom
10 from . import dynamic
---> 11 from . import gencache
12 import sys
13 import pywintypes
C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\gencache.py in <module>()
658
659 # Boot up
--> 660 __init__()
661
662 def usage():
C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\gencache.py in __init__()
58 # Initialize the module. Called once explicitly at module import below
59 try:
---> 60 _LoadDicts()
61 except IOError:
62 Rebuild()
C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\gencache.py in _LoadDicts()
111 try:
112 p = pickle.Unpickler(f)
--> 113 version = p.load()
114 global clsidToTypelib
115 clsidToTypelib = p.load()
UnpicklingError: invalid load key, '\x00'.

ImportError: DLL load failed: The specified procedure could not be found. (import sklearn)

When I import sklearn, it throws this ImportError(DLL load failed: The specified procedure could not be found.)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-b7c74cbf5af0> in <module>()
----> 1 import sklearn
~\Anaconda3\lib\site-packages\sklearn\__init__.py in <module>()
62 else:
63 from . import __check_build
---> 64 from .base import clone
65 from .utils._show_versions import show_versions
66
~\Anaconda3\lib\site-packages\sklearn\base.py in <module>()
11 from scipy import sparse
12 from .externals import six
---> 13 from .utils.fixes import signature
14 from . import __version__
15
~\Anaconda3\lib\site-packages\sklearn\utils\__init__.py in <module>()
11
12 from .murmurhash import murmurhash3_32
---> 13 from .validation import (as_float_array,
14 assert_all_finite,
15 check_random_state, column_or_1d, check_array,
~\Anaconda3\lib\site-packages\sklearn\utils\validation.py in <module>()
20
21 from ..externals import six
---> 22 from ..utils.fixes import signature
23 from .. import get_config as _get_config
24 from ..exceptions import NonBLASDotWarning
~\Anaconda3\lib\site-packages\sklearn\utils\fixes.py in <module>()
81 return stats.boxcox(x, lmbda)
82 else:
---> 83 from scipy.special import boxcox # noqa
84
85
~\Anaconda3\lib\site-packages\scipy\special\__init__.py in <module>()
638 from .sf_error import SpecialFunctionWarning, SpecialFunctionError
639
--> 640 from ._ufuncs import *
641
642 from .basic import *
ImportError: DLL load failed: The specified procedure could not be found.
If you already have a working installation of numpy and scipy, then do this:
pip install -U scikit-learn
otherwise:
conda install scikit-learn
finally check for updates:
conda update pip

Error while importing seaborn in Anaconda

I'm getting the below error while importing seaborn.
Installing/Uninstalling is not working.
Copying dll files in win32 folder and setting path didn't work.I'm using 32-bit windows 7 machine. output of sys.path as below :
['',
'C:\\Users\\PAL\\Anaconda3\\python35.zip',
'C:\\Users\\PAL\\Anaconda3\\DLLs',
'C:\\Users\\PAL\\Anaconda3\\lib',
'C:\\Users\\PAL\\Anaconda3',
'C:\\Users\\PAL\\Anaconda3\\lib\\site-packages',
'C:\\Users\\PAL\\Anaconda3\\lib\\site-packages\\Sphinx-1.4.1-py3.5.egg',
'C:\\Users\\PAL\\Anaconda3\\lib\\site-packages\\win32',
'C:\\Users\\PAL\\Anaconda3\\lib\\site-packages\\win32\\lib',
'C:\\Users\\PAL\\Anaconda3\\lib\\site-packages\\Pythonwin',
'C:\\Users\\PAL\\Anaconda3\\lib\\site-packages\\setuptools-23.0.0-py3.5.egg',
'C:\\Users\\PAL\\Anaconda3\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\PAL\\.ipython']
Error while importing seaborn:
ImportError Traceback (most recent call last)
in ()
----> 1 import seaborn as sns
C:\Users\PAL\Anaconda3\lib\site-packages\seaborn\__init__.py in <module>()
4
5 # Import seaborn objects
----> 6 from .rcmod import *
7 from .utils import *
8 from .palettes import *
C:\Users\PAL\Anaconda3\lib\site-packages\seaborn\rcmod.py in <module>()
6 import matplotlib as mpl
7
----> 8 from . import palettes, _orig_rc_params
9
10
C:\Users\PAL\Anaconda3\lib\site-packages\seaborn\palettes.py in <module>()
10 from .external.six.moves import range
11
---> 12 from .utils import desaturate, set_hls_values, get_color_cycle
13 from .xkcd_rgb import xkcd_rgb
14 from .crayons import crayons
C:\Users\PAL\Anaconda3\lib\site-packages\seaborn\utils.py in <module>()
6
7 import numpy as np
----> 8 from scipy import stats
9 import pandas as pd
10 import matplotlib as mpl
C:\Users\PAL\Anaconda3\lib\site-packages\scipy\stats\__init__.py in <module>()
336 from __future__ import division, print_function, absolute_import
337
--> 338 from .stats import *
339 from .distributions import *
340 from .morestats import *
C:\Users\PAL\Anaconda3\lib\site-packages\scipy\stats\stats.py in <module>()
178 from scipy._lib.six import callable, string_types
179 from numpy import array, asarray, ma, zeros
--> 180 import scipy.special as special
181 import scipy.linalg as linalg
182 import numpy as np
C:\Users\PAL\Anaconda3\lib\site-packages\scipy\special\__init__.py in <module>()
625 from __future__ import division, print_function, absolute_import
626
--> 627 from ._ufuncs import *
628
629 from .basic import *
ImportError: DLL load failed: The specified procedure could not be
found.

sklearn import error. No module named winreg on ubuntu 14.04

When I try to import a module from sklearn a receive an error:
In [1]: import sklearn
In [2]: from sklearn.linear_model import Lasso
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-b932cb9c16f8> in <module>()
----> 1 from sklearn.linear_model import Lasso
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/__init__.py in <module>()
10 # complete documentation.
11
---> 12 from .base import LinearRegression
13
14 from .bayes import BayesianRidge, ARDRegression
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/base.py in <module>()
26 from ..externals.joblib import Parallel, delayed
27 from ..base import BaseEstimator, ClassifierMixin, RegressorMixin
---> 28 from ..utils import as_float_array, atleast2d_or_csr, safe_asarray
29 from ..utils.extmath import safe_sparse_dot
30 from ..utils.sparsefuncs import mean_variance_axis0, inplace_column_scale
/usr/local/lib/python3.4/dist-packages/sklearn/utils/__init__.py in <module>()
9
10 from .murmurhash import murmurhash3_32
---> 11 from .validation import (as_float_array, check_arrays, safe_asarray,
12 assert_all_finite, array2d, atleast2d_or_csc,
13 atleast2d_or_csr, warn_if_not_float,
/usr/local/lib/python3.4/dist-packages/sklearn/utils/validation.py in <module>()
15
16 from ..externals import six
---> 17 from .fixes import safe_copy
18
19
/usr/local/lib/python3.4/dist-packages/sklearn/utils/fixes.py in <module>()
103
104 try:
--> 105 with ignore_warnings():
106 # Don't raise the numpy deprecation warnings that appear in
107 # 1.9
/usr/local/lib/python3.4/dist-packages/sklearn/utils/testing.py in __enter__(self)
297
298 def __enter__(self):
--> 299 clean_warning_registry() # be safe and not propagate state + chaos
300 warnings.simplefilter('always')
301 if self._entered:
/usr/local/lib/python3.4/dist-packages/sklearn/utils/testing.py in clean_warning_registry()
582 reg = "__warningregistry__"
583 for mod in sys.modules.copy().values():
--> 584 if hasattr(mod, reg):
585 getattr(mod, reg).clear()
586
/usr/lib/python3/dist-packages/scipy/lib/six.py in __getattr__(self, attr)
114 if attr in ("__file__", "__name__") and self.mod not in sys.modules:
115 raise AttributeError
--> 116 _module = self._resolve()
117 value = getattr(_module, attr)
118 setattr(self, attr, value)
/usr/lib/python3/dist-packages/scipy/lib/six.py in _resolve(self)
103
104 def _resolve(self):
--> 105 return _import_module(self.mod)
106
107 def __getattr__(self, attr):
/usr/lib/python3/dist-packages/scipy/lib/six.py in _import_module(name)
74 def _import_module(name):
75 """Import module, returning the module after the last dot."""
---> 76 __import__(name)
77 return sys.modules[name]
78
ImportError: No module named 'winreg'
In [3]:
I have installed sklearn with the command pip3 as explained in the official documentation
In [3]: sklearn.__version__
Out[3]: '0.15.1'
winreg should be a module available only for windows... how can I solve this?
EDIT:
This is the command that I have used to install sklearn :
sudo pip3 install -U scikit-learn
I have solved removing sklearn and installing the git version as explained here
https://askubuntu.com/questions/449326/installation-error-in-sklearn-for-python3

Resources