I'm trying to learn pandas by watching this video: https://www.youtube.com/watch?v=5JnMutdy6Fw. I downloaded the notebooks (https://github.com/brandon-rhodes/pycon-pandas-tutorial/), and loaded up Exercises-1. The first block
%matplotlib inline
import pandas as pd
is giving me this error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-10-5761ac74df30> in <module>()
----> 1 get_ipython().magic(u'matplotlib inline')
2 import pandas as pd
/Users/***/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2305 magic_name, _, magic_arg_s = arg_s.partition(' ')
2306 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2307 return self.run_line_magic(magic_name, magic_arg_s)
2308
2309 #-------------------------------------------------------------------------
/Users/***/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2226 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2227 with self.builtin_trap:
-> 2228 result = fn(*args,**kwargs)
2229 return result
2230
/Users/***/anaconda/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in matplotlib(self, line)
/Users/***/anaconda/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/Users/***/anaconda/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in matplotlib(self, line)
86 """
87 args = magic_arguments.parse_argstring(self.matplotlib, line)
---> 88 gui, backend = self.shell.enable_matplotlib(args.gui)
89 self._show_matplotlib_backend(args.gui, backend)
90
/Users/***/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in enable_matplotlib(self, gui)
3087 """
3088 from IPython.core import pylabtools as pt
-> 3089 gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select)
3090
3091 if gui != 'inline':
/Users/***/anaconda/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in find_gui_and_backend(gui, gui_select)
237 """
238
--> 239 import matplotlib
240
241 if gui and gui != 'auto':
/Users/***/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/__init__.py in <module>()
178 # cbook must import matplotlib only within function
179 # definitions, so it is safe to import from it here.
--> 180 from matplotlib.cbook import is_string_like
181 from matplotlib.compat import subprocess
182
/Users/***/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/cbook.py in <module>()
31 from weakref import ref, WeakKeyDictionary
32
---> 33 import numpy as np
34 import numpy.ma as ma
35
/Users/***/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/__init__.py in <module>()
183 return loader(*packages, **options)
184
--> 185 from . import add_newdocs
186 __all__ = ['add_newdocs',
187 'ModuleDeprecationWarning',
/Users/***/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/add_newdocs.py in <module>()
11 from __future__ import division, absolute_import, print_function
12
---> 13 from numpy.lib import add_newdoc
14
15 ###############################################################################
/Users/***/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/lib/__init__.py in <module>()
15 from .ufunclike import *
16
---> 17 from . import scimath as emath
18 from .polynomial import *
19 #import convertcode
ImportError: cannot import name scimath
Can someone tell me what's happening and how I can fix it?
You can read about a similar issue here and here.
The main problem is with importing scimath:
"ImportError: cannot import name scimath"
You can try to import scimath.
A better solution would be to set your PYTHONPATH var, which provides the python interpreter with additional directories look in for python packages/modules. You can read more about setting PYTHONPATH variable here.
Related
I am trying to run some R code in a predominantly Python script in Jupyter Notebook.
I have conda installed rpy2 on my terminal. Calling import rpy2 in my script works.
But when I try to run %load_ext rpy2.ipython (which is a necessary step to run R code), I have the following error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-13-fb23c6edefe4> in <module>
----> 1 get_ipython().run_line_magic('load_ext', 'rpy2.ipython')
~/opt/anaconda3/lib/python3.7/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
</Users/dpatrick/opt/anaconda3/lib/python3.7/site-packages/decorator.py:decorator-gen-64> in load_ext(self, module_str)
~/opt/anaconda3/lib/python3.7/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):
~/opt/anaconda3/lib/python3.7/site-packages/IPython/core/magics/extension.py in load_ext(self, module_str)
31 if not module_str:
32 raise UsageError('Missing module name.')
---> 33 res = self.shell.extension_manager.load_extension(module_str)
34
35 if res == 'already loaded':
~/opt/anaconda3/lib/python3.7/site-packages/IPython/core/extensions.py in load_extension(self, module_str)
78 if module_str not in sys.modules:
79 with prepended_to_syspath(self.ipython_extension_dir):
---> 80 mod = import_module(module_str)
81 if mod.__file__.startswith(self.ipython_extension_dir):
82 print(("Loading extensions from {dir} is deprecated. "
~/opt/anaconda3/lib/python3.7/importlib/__init__.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129
~/opt/anaconda3/lib/python3.7/importlib/_bootstrap.py in _gcd_import(name, package, level)
~/opt/anaconda3/lib/python3.7/importlib/_bootstrap.py in _find_and_load(name, import_)
~/opt/anaconda3/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)
~/opt/anaconda3/lib/python3.7/importlib/_bootstrap.py in _load_unlocked(spec)
~/opt/anaconda3/lib/python3.7/importlib/_bootstrap_external.py in exec_module(self, module)
~/opt/anaconda3/lib/python3.7/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~/opt/anaconda3/lib/python3.7/site-packages/rpy2/ipython/__init__.py in <module>
----> 1 from . import rmagic
2
3 load_ipython_extension = rmagic.load_ipython_extension
~/opt/anaconda3/lib/python3.7/site-packages/rpy2/ipython/rmagic.py in <module>
53 # numpy and rpy2 imports
54
---> 55 import rpy2.rinterface as ri
56 import rpy2.rinterface_lib.callbacks
57 import rpy2.robjects as ro
~/opt/anaconda3/lib/python3.7/site-packages/rpy2/rinterface.py in <module>
5 import typing
6 from rpy2.rinterface_lib import openrlib
----> 7 import rpy2.rinterface_lib._rinterface_capi as _rinterface
8 import rpy2.rinterface_lib.embedded as embedded
9 import rpy2.rinterface_lib.conversion as conversion
~/opt/anaconda3/lib/python3.7/site-packages/rpy2/rinterface_lib/_rinterface_capi.py in <module>
8 from _rinterface_cffi import ffi
9 from . import conversion
---> 10 from . import embedded
11 from . import memorymanagement
12
~/opt/anaconda3/lib/python3.7/site-packages/rpy2/rinterface_lib/embedded.py in <module>
6 from _rinterface_cffi import ffi
7 from . import openrlib
----> 8 from . import callbacks
9
10 _options = ('rpy2', '--quiet', '--no-save')
~/opt/anaconda3/lib/python3.7/site-packages/rpy2/rinterface_lib/callbacks.py in <module>
34
35 #ffi_proxy.callback(ffi_proxy._consoleflush_def,
---> 36 ffi)
37 def _consoleflush():
38 try:
~/opt/anaconda3/lib/python3.7/site-packages/rpy2/rinterface_lib/ffi_proxy.py in decorator(func)
42 'void', ('SEXP',))
43 _evaluate_in_r_def = SignatureDefinition('_evaluate_in_r',
---> 44 'SEXP', ('SEXP args',))
45
46
AttributeError: 'CompiledFFI' object has no attribute 'ffi'
What exactly is this 'CompiledFFI' error? How should I fix it?
Thanks so much for your help!
Using Jupyter notebook via Anaconda2 on a Windows7 OS 64-bit launching it with GraphLabCreate. Getting the following error when executing the command "import matplotlib.pyplot as plt".
Is it anything to do with the environmental variables as I'm using GraphLabCreate? They have the following from a tool bar command selection:
set "PATH=C:\Users\Owner\Anaconda2;C:\Users\Owner\Anaconda2\Scripts;%PATH%"
I've gone ahead and checked the environmental variables and they are listed as above (except for the %PATH% part). Here are the PATH variables on my computer:
C:\Users\Owner\Anaconda2;C:\Users\Owner\Anaconda2\Scripts;C:\Users\Owner\Anaconda2\Library\bin;C:\Program Files\R\R-3.4.2\bin\x64
Here is the entire error output:
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-9-6f467123fe04> in <module>()
----> 1 import matplotlib.pyplot
C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\pyplot.py in <module>()
27 from cycler import cycler
28 import matplotlib
---> 29 import matplotlib.colorbar
30 from matplotlib import style
31 from matplotlib import _pylab_helpers, interactive
C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\colorbar.py in <module>()
32 import matplotlib.artist as martist
33 import matplotlib.cbook as cbook
---> 34 import matplotlib.collections as collections
35 import matplotlib.colors as colors
36 import matplotlib.contour as contour
C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\collections.py in <module>()
25 import matplotlib.artist as artist
26 from matplotlib.artist import allow_rasterization
---> 27 import matplotlib.backend_bases as backend_bases
28 import matplotlib.path as mpath
29 from matplotlib import _path
C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\backend_bases.py in <module>()
60
61 import matplotlib.tight_bbox as tight_bbox
---> 62 import matplotlib.textpath as textpath
63 from matplotlib.path import Path
64 from matplotlib.cbook import mplDeprecation, warn_deprecated
C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\textpath.py in <module>()
13 from matplotlib.path import Path
14 from matplotlib import rcParams
---> 15 import matplotlib.font_manager as font_manager
16 from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING
17 from matplotlib.ft2font import LOAD_TARGET_LIGHT
C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\font_manager.py in <module>()
1419 verbose.report("Using fontManager instance from %s" % _fmcache)
1420 except:
-> 1421 _rebuild()
1422 else:
1423 _rebuild()
C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\font_manager.py in _rebuild()
1404 def _rebuild():
1405 global fontManager
-> 1406 fontManager = FontManager()
1407 if _fmcache:
1408 pickle_dump(fontManager, _fmcache)
C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\font_manager.py in __init__(self, size, weight)
1042 # Load TrueType fonts and create font dictionary.
1043
-> 1044 self.ttffiles = findSystemFonts(paths) + findSystemFonts()
1045 self.defaultFamily = {
1046 'ttf': 'Bitstream Vera Sans',
C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\font_manager.py in findSystemFonts(fontpaths, fontext)
311 fontpaths = [fontdir]
312 # now get all installed fonts directly...
--> 313 for f in win32InstalledFonts(fontdir):
314 base, ext = os.path.splitext(f)
315 if len(ext)>1 and ext[1:].lower() in fontexts:
C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\font_manager.py in win32InstalledFonts(directory, fontext)
228 continue
229 if not os.path.dirname(direc):
--> 230 direc = os.path.join(directory, direc)
231 direc = os.path.abspath(direc).lower()
232 if os.path.splitext(direc)[1][1:] in fontext:
C:\Users\Owner\Anaconda2\envs\gl-env\lib\ntpath.pyc in join(path, *paths)
83 if result_path and result_path[-1] not in '\\/':
84 result_path = result_path + '\\'
---> 85 result_path = result_path + p_path
86 ## add separator between UNC and non-absolute path
87 if (result_path and result_path[0] not in '\\/' and
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 7: ordinal not in range(128)
I was trying to plot a graphic with matplotlib in Jupyter and then with only the 'pylab inline' the following error shows up. I'm working with python 3.x and anaconda in a macbook. I found similar trends (for example this) with some potential solutions but they didn't work. I have tried everything but nothing works. I would really appreciate any help.
My code:
%pylab inline
which produces the following error:
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
//anaconda/lib/python3.6/site-packages/matplotlib/font_manager.py in <module>()
1429 try:
-> 1430 fontManager = pickle_load(_fmcache)
1431 if (not hasattr(fontManager, '_version') or
//anaconda/lib/python3.6/site-packages/matplotlib/font_manager.py in pickle_load(filename)
965 """
--> 966 with open(filename, 'rb') as fh:
967 data = pickle.load(fh)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/sebasg167/.matplotlib/fontList.py3k.cache'
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-2-d4543581fa9d> in <module>()
----> 1 get_ipython().magic('pylab inline')
//anaconda/lib/python3.6/site-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
2156 magic_name, _, magic_arg_s = arg_s.partition(' ')
2157 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2158 return self.run_line_magic(magic_name, magic_arg_s)
2159
2160 #-------------------------------------------------------------------------
//anaconda/lib/python3.6/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line)
2077 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2078 with self.builtin_trap:
-> 2079 result = fn(*args,**kwargs)
2080 return result
2081
<decorator-gen-105> in pylab(self, line)
//anaconda/lib/python3.6/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
186 # but it's overkill for just that one bit of state.
187 def magic_deco(arg):
--> 188 call = lambda f, *a, **k: f(*a, **k)
189
190 if callable(arg):
//anaconda/lib/python3.6/site-packages/IPython/core/magics/pylab.py in pylab(self, line)
154 import_all = not args.no_import_all
155
--> 156 gui, backend, clobbered = self.shell.enable_pylab(args.gui, import_all=import_all)
157 self._show_matplotlib_backend(args.gui, backend)
158 print ("Populating the interactive namespace from numpy and matplotlib")
//anaconda/lib/python3.6/site-packages/IPython/core/interactiveshell.py in enable_pylab(self, gui, import_all, welcome_message)
2984 from IPython.core.pylabtools import import_pylab
2985
-> 2986 gui, backend = self.enable_matplotlib(gui)
2987
2988 # We want to prevent the loading of pylab to pollute the user's
//anaconda/lib/python3.6/site-packages/IPython/core/interactiveshell.py in enable_matplotlib(self, gui)
2945 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select)
2946
-> 2947 pt.activate_matplotlib(backend)
2948 pt.configure_inline_support(self, backend)
2949
//anaconda/lib/python3.6/site-packages/IPython/core/pylabtools.py in activate_matplotlib(backend)
292 matplotlib.rcParams['backend'] = backend
293
--> 294 import matplotlib.pyplot
295 matplotlib.pyplot.switch_backend(backend)
296
//anaconda/lib/python3.6/site-packages/matplotlib/pyplot.py in <module>()
27 from cycler import cycler
28 import matplotlib
---> 29 import matplotlib.colorbar
30 from matplotlib import style
31 from matplotlib import _pylab_helpers, interactive
//anaconda/lib/python3.6/site-packages/matplotlib/colorbar.py in <module>()
34 import matplotlib.collections as collections
35 import matplotlib.colors as colors
---> 36 import matplotlib.contour as contour
37 import matplotlib.cm as cm
38 import matplotlib.gridspec as gridspec
//anaconda/lib/python3.6/site-packages/matplotlib/contour.py in <module>()
20 import matplotlib.colors as colors
21 import matplotlib.collections as mcoll
---> 22 import matplotlib.font_manager as font_manager
23 import matplotlib.text as text
24 import matplotlib.cbook as cbook
//anaconda/lib/python3.6/site-packages/matplotlib/font_manager.py in <module>()
1438 raise
1439 except:
-> 1440 _rebuild()
1441 else:
1442 _rebuild()
//anaconda/lib/python3.6/site-packages/matplotlib/font_manager.py in _rebuild()
1417 global fontManager
1418
-> 1419 fontManager = FontManager()
1420
1421 if _fmcache:
//anaconda/lib/python3.6/site-packages/matplotlib/font_manager.py in __init__(self, size, weight)
1071 self.afmfiles = findSystemFonts(paths, fontext='afm') + \
1072 findSystemFonts(fontext='afm')
-> 1073 self.afmlist = createFontList(self.afmfiles, fontext='afm')
1074 if len(self.afmfiles):
1075 self.defaultFont['afm'] = self.afmfiles[0]
//anaconda/lib/python3.6/site-packages/matplotlib/font_manager.py in createFontList(fontfiles, fontext)
589 continue
590 try:
--> 591 prop = afmFontProperty(fpath, font)
592 except KeyError:
593 continue
//anaconda/lib/python3.6/site-packages/matplotlib/font_manager.py in afmFontProperty(fontpath, font)
498 """
499
--> 500 name = font.get_familyname()
501 fontname = font.get_fontname().lower()
502
//anaconda/lib/python3.6/site-packages/matplotlib/afm.py in get_familyname(self)
523 extras = (br'(?i)([ -](regular|plain|italic|oblique|bold|semibold|'
524 br'light|ultralight|extra|condensed))+$')
--> 525 return re.sub(extras, '', name)
526
527 #property
//anaconda/lib/python3.6/re.py in sub(pattern, repl, string, count, flags)
189 a callable, it's passed the match object and must return
190 a replacement string to be used."""
--> 191 return _compile(pattern, flags).sub(repl, string, count)
192
193 def subn(pattern, repl, string, count=0, flags=0):
TypeError: cannot use a bytes pattern on a string-like object
You must find this file :
font_manager.py
in my case : C:\Users\gustavo\Anaconda3\Lib\site-packages\matplotlib\ font_manager.py
and FIND def win32InstalledFonts(directory=None, fontext='ttf')
and replace
by :
def win32InstalledFonts(directory=None, fontext='ttf'):
"""
Search for fonts in the specified font directory, or use the
system directories if none given. A list of TrueType font
filenames are returned by default, or AFM fonts if fontext ==
'afm'.
"""
from six.moves import winreg
if directory is None:
directory = win32FontDirectory()
fontext = get_fontext_synonyms(fontext)
key, items = None, {}
for fontdir in MSFontDirectories:
try:
local = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, fontdir)
except OSError:
continue
if not local:
return list_fonts(directory, fontext)
try:
for j in range(winreg.QueryInfoKey(local)[1]):
try:
key, direc, any = winreg.EnumValue(local, j)
if not is_string_like(direc):
continue
if not os.path.dirname(direc):
direc = os.path.join(directory, direc)
direc = direc.split('\0', 1)[0]
if os.path.splitext(direc)[1][1:] in fontext:
items[direc] = 1
except EnvironmentError:
continue
except WindowsError:
continue
except MemoryError:
continue
return list(six.iterkeys(items))
finally:
winreg.CloseKey(local)
return None
I don't know why this happened. How shall I solve it?
In [1]: %matplotlib inline
And I got this:
AttributeError: 'NoneType' object has no attribute 'is_interactive'
In [1]: %matplotlib inline
---------------------------------------------------------------------------
UnknownBackend Traceback (most recent call last)
<ipython-input-1-2b1da000a957> in <module>()
----> 1 get_ipython().magic(u'matplotlib inline')
/Users/wonderful/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2156 magic_name, _, magic_arg_s = arg_s.partition(' ')
2157 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2158 return self.run_line_magic(magic_name, magic_arg_s)
2159
2160 #-------------------------------------------------------------------------
/Users/wonderful/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2077 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2078 with self.builtin_trap:
-> 2079 result = fn(*args,**kwargs)
2080 return result
2081
<decorator-gen-104> in matplotlib(self, line)
/Users/wonderful/anaconda/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
186 # but it's overkill for just that one bit of state.
187 def magic_deco(arg):
--> 188 call = lambda f, *a, **k: f(*a, **k)
189
190 if callable(arg):
/Users/wonderful/anaconda/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in matplotlib(self, line)
98 print("Available matplotlib backends: %s" % backends_list)
99 else:
--> 100 gui, backend = self.shell.enable_matplotlib(args.gui)
101 self._show_matplotlib_backend(args.gui, backend)
102
/Users/wonderful/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in enable_matplotlib(self, gui)
2945 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select)
2946
-> 2947 pt.activate_matplotlib(backend)
2948 pt.configure_inline_support(self, backend)
2949
/Users/wonderful/anaconda/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in activate_matplotlib(backend)
292 matplotlib.rcParams['backend'] = backend
293
--> 294 import matplotlib.pyplot
295 matplotlib.pyplot.switch_backend(backend)
296
/Users/wonderful/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>()
2510 # are no-ops and the registered function respect `mpl.is_interactive()`
2511 # to determine if they should trigger a draw.
-> 2512 install_repl_displayhook()
2513
2514 ################# REMAINING CONTENT GENERATED BY boilerplate.py ##############
/Users/wonderful/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py in install_repl_displayhook()
163 ipython_gui_name = backend2gui.get(get_backend())
164 if ipython_gui_name:
--> 165 ip.enable_gui(ipython_gui_name)
166 else:
167 _INSTALL_FIG_OBSERVER = True
/Users/wonderful/anaconda/lib/python2.7/site-packages/IPython/terminal/interactiveshell.pyc in enable_gui(self, gui)
450 def enable_gui(self, gui=None):
451 if gui:
--> 452 self._inputhook = get_inputhook_func(gui)
453 else:
454 self._inputhook = None
/Users/wonderful/anaconda/lib/python2.7/site-packages/IPython/terminal/pt_inputhooks/__init__.pyc in get_inputhook_func(gui)
36
37 if gui not in backends:
---> 38 raise UnknownBackend(gui)
39
40 if gui in aliases:
UnknownBackend: No event loop integration for 'inline'. Supported event loops are: qt, qt4, qt5, gtk, gtk2, gtk3, tk, wx, pyglet, glut, osx
Error in callback <function post_execute at 0x10ad69500> (for post_execute):
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/Users/wonderful/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py in post_execute()
145
146 def post_execute():
--> 147 if matplotlib.is_interactive():
148 draw_all()
149
AttributeError: 'NoneType' object has no attribute 'is_interactive'
For me,
pip install jupyter_console
then
ipython console('jupyter console' recommend)
In [1]: %matplotlib inline
work fine.
ipython console --matplotlib inline
will raise an error:
Unrecognized flag: '--matplotlib'
After some fixing my PATH variable to get some library installs to work , I'm finding that my IPython Notebook (Enthought Canopy on Ubuntu 14.04) throws the following error when using the %matplotlib magic command:
ImportError: /home/joe/Enthought/Canopy_64bit/User/bin/../lib/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3)
I'm also getting this error when trying to install python-bio-formats, pims, and pylibtiff.
Again, any ideas are appreciated.
EDIT: Full error traceback:
ImportError Traceback (most recent call last)
<ipython-input-1-3042faeb62d7> in <module>()
----> 1 get_ipython().magic(u'matplotlib')
2 #import cv2
3 #import numpy as np
4 #import pandas as pd
5 #import os
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2203 magic_name, _, magic_arg_s = arg_s.partition(' ')
2204 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2205 return self.run_line_magic(magic_name, magic_arg_s)
2206
2207 #-------------------------------------------------------------------------
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2124 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2125 with self.builtin_trap:
-> 2126 result = fn(*args,**kwargs)
2127 return result
2128
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in matplotlib(self, line)
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in matplotlib(self, line)
78 """
79 args = magic_arguments.parse_argstring(self.matplotlib, line)
---> 80 gui, backend = self.shell.enable_matplotlib(args.gui)
81 self._show_matplotlib_backend(args.gui, backend)
82
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in enable_matplotlib(self, gui)
2929 """
2930 from IPython.core import pylabtools as pt
-> 2931 gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select)
2932
2933 if gui != 'inline':
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in find_gui_and_backend(gui, gui_select)
250 """
251
--> 252 import matplotlib
253
254 if gui and gui != 'auto':
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/__init__.py in <module>()
177 # cbook must import matplotlib only within function
178 # definitions, so it is safe to import from it here.
--> 179 from matplotlib.cbook import is_string_like
180 from matplotlib.compat import subprocess
181
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/cbook.py in <module>()
30 from weakref import ref, WeakKeyDictionary
31
---> 32 import numpy as np
33 import numpy.ma as ma
34
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/__init__.pyc in <module>()
168 return loader(*packages, **options)
169
--> 170 from . import add_newdocs
171 __all__ = ['add_newdocs',
172 'ModuleDeprecationWarning',
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/add_newdocs.py in <module>()
11 from __future__ import division, absolute_import, print_function
12
---> 13 from numpy.lib import add_newdoc
14
15 ###############################################################################
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/lib/__init__.py in <module>()
16
17 from . import scimath as emath
---> 18 from .polynomial import *
19 #import convertcode
20 from .utils import *
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/lib/polynomial.py in <module>()
17 from numpy.lib.function_base import trim_zeros, sort_complex
18 from numpy.lib.type_check import iscomplex, real, imag
---> 19 from numpy.linalg import eigvals, lstsq, inv
20
21 class RankWarning(UserWarning):
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/linalg/__init__.py in <module>()
49 from .info import __doc__
50
---> 51 from .linalg import *
52
53 from numpy.testing import Tester
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/linalg/linalg.py in <module>()
27 )
28 from numpy.lib import triu, asfarray
---> 29 from numpy.linalg import lapack_lite, _umath_linalg
30 from numpy.matrixlib.defmatrix import matrix_power
31 from numpy.compat import asbytes
ImportError: /home/joe/Enthought/Canopy_64bit/User/bin/../lib/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3)
Full PATH (from echo $PATH):
/home/joe/Enthought/Canopy_64bit/User/bin:
/home/joe/Enthought/Canopy_64bit/User/bin:
/usr/local/sbin:
/usr/local/bin:
/usr/sbin:
/usr/bin:
/sbin:
/bin:
/usr/games:
/usr/local/games
sys.path:
['', '/home/joe/Enthought/Canopy_64bit/User/src/svn',
'/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pims',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python27.zip',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/plat-linux2',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/lib-tk',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/lib-old',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/lib-dynload',
'/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages',
'/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/PIL',
'/home/joe/opencv-2.4.9',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/site-packages']
I was able to resolve this error by following the steps outlined here (specifically, steps 3-5): https://support.enthought.com/entries/23580651-Uninstalling-and-resetting-Canopy.
When re-attempting to install pims (https://github.com/soft-matter/pims) using pip (command: pip install --upgrade http://github.com/soft-matter/pims/zipball/master), the problem is able to be replicated. Odd.
I'm also getting a problem when trying to install pylibtiff via its setup.py script, but I will post this in another SO post, further detailing the error.
This might be late, but you can try the following thread
https://github.com/ContinuumIO/anaconda-issues/issues/686
Specifically the one by Zarhid:
conda remove libgfortran
conda install libgcc --force
replace conda with pip and modify accordingly. Worked for me