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
Related
I am executing the following piece of code in Jupyter Notebook
import os
import shlex
files = os.listdir("./data/")
for file in files:
%run -timeout=5 -i solver.py ./data/$file
I get the following error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~/Desktop/GitHub/coursera/discrete-optimization/week2/knapsack/solver.py in <module>
1 for file in files:
----> 2 get_ipython().run_line_magic('run', '-timeout=5 -i solver.py ./data/$file')
~/opt/anaconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
2324 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2325 with self.builtin_trap:
-> 2326 result = fn(*args, **kwargs)
2327 return result
2328
<decorator-gen-59> in run(self, parameter_s, runner, file_finder)
~/opt/anaconda3/lib/python3.8/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.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
687 if "m" in opts:
688 modulename = opts["m"][0]
--> 689 modpath = find_mod(modulename)
690 if modpath is None:
691 msg = '%r is not a valid modulename on sys.path'%modulename
~/opt/anaconda3/lib/python3.8/site-packages/IPython/utils/module_paths.py in find_mod(module_name)
60 """
61 loader = importlib.util.find_spec(module_name)
---> 62 module_path = loader.origin
63 if module_path is None:
64 return None
AttributeError: 'NoneType' object has no attribute 'origin'
Clearly, the timeout option is not working.
What is the correct way to set a timeout option for my code? I want to stop execution for a test case if it reaches beyond a specific time, for example, 5 sec.
You can do
import os
import shlex
files = os.listdir("./data/")
for file in files:
! timeout 5 python solver.py ./data/$file
Since yesterday
import matplotlib.pyplot as plt
gives me this ValueError "variadic keyword parameters cannot have default values".
Below the error:
ValueError Traceback (most recent call last)
<ipython-input-1-a0d2faabd9e9> in <module>
----> 1 import matplotlib.pyplot as plt
~\AppData\Roaming\Python\Python37\site-packages\matplotlib\pyplot.py in <module>
30 from cycler import cycler
31 import matplotlib
---> 32 import matplotlib.colorbar
33 import matplotlib.image
34 from matplotlib import rcsetup, style
~\AppData\Roaming\Python\Python37\site-packages\matplotlib\colorbar.py in <module>
38
39 import matplotlib as mpl
---> 40 import matplotlib.artist as martist
41 import matplotlib.cbook as cbook
42 import matplotlib.collections as collections
~\AppData\Roaming\Python\Python37\site-packages\matplotlib\artist.py in <module>
58
59
---> 60 class Artist:
61 """
62 Abstract base class for objects that render into a FigureCanvas.
~\AppData\Roaming\Python\Python37\site-packages\matplotlib\artist.py in Artist()
899
900 #cbook._delete_parameter("3.3", "args")
--> 901 #cbook._delete_parameter("3.3", "kwargs")
902 def draw(self, renderer, *args, **kwargs):
903 """
~\AppData\Roaming\Python\Python37\site-packages\matplotlib\cbook\deprecation.py in _delete_parameter(since, name, func)
343 param.replace(default=_deprecated_parameter) if param.name == name
344 else param
--> 345 for param in signature.parameters.values()])
346
347 #functools.wraps(func)
~\AppData\Roaming\Python\Python37\site-packages\matplotlib\cbook\deprecation.py in <listcomp>(.0)
343 param.replace(default=_deprecated_parameter) if param.name == name
344 else param
--> 345 for param in signature.parameters.values()])
346
347 #functools.wraps(func)
~\Anaconda3\lib\inspect.py in replace(self, name, kind, annotation, default)
2547 default = self._default
2548
-> 2549 return type(self)(name, kind, default=default, annotation=annotation)
2550
2551 def __str__(self):
~\Anaconda3\lib\inspect.py in __init__(self, name, kind, default, annotation)
2474 msg = '{} parameters cannot have default values'
2475 msg = msg.format(_get_paramkind_descr(self._kind))
-> 2476 raise ValueError(msg)
2477 self._default = default
2478 self._annotation = annotation
ValueError: variadic keyword parameters cannot have default values
I've tried to uninstall matplotlib and reinstall it and install a different version but nothing seems to work
Anybody has other ideas?
thank you
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'
I tried to install matplotlib on Windows 10 Bash shell.
After that, I ran following lines:
$ ipython3
then
In[1]: %pylab
then it gives me a following error:
---------------------------------------------------------------------------
TclError Traceback (most recent call last)
<ipython-input-1-4ab7ec3413a5> in <module>()
----> 1 get_ipython().magic('pylab')
/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
2164 magic_name, _, magic_arg_s = arg_s.partition(' ')
2165 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2166 return self.run_line_magic(magic_name, magic_arg_s)
2167
2168 #-------------------------------------------------------------------------
/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line)
2085 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2086 with self.builtin_trap:
-> 2087 result = fn(*args,**kwargs)
2088 return result
2089
/usr/lib/python3/dist-packages/IPython/core/magics/pylab.py in pylab(self, line)
/usr/lib/python3/dist-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
190 # but it's overkill for just that one bit of state.
191 def magic_deco(arg):
--> 192 call = lambda f, *a, **k: f(*a, **k)
193
194 if isinstance(arg, collections.Callable):
/usr/lib/python3/dist-packages/IPython/core/magics/pylab.py in pylab(self, line)
129 import_all = not args.no_import_all
130
--> 131 gui, backend, clobbered = self.shell.enable_pylab(args.gui, import_all=import_all)
132 self._show_matplotlib_backend(args.gui, backend)
133 print ("Populating the interactive namespace from numpy and matplotlib")
/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in enable_pylab(self, gui, import_all, welcome_message)
2918 from IPython.core.pylabtools import import_pylab
2919
-> 2920 gui, backend = self.enable_matplotlib(gui)
2921
2922 # We want to prevent the loading of pylab to pollute the user's
/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in enable_matplotlib(self, gui)
2879 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select)
2880
-> 2881 pt.activate_matplotlib(backend)
2882 pt.configure_inline_support(self, backend)
2883
/usr/lib/python3/dist-packages/IPython/core/pylabtools.py in activate_matplotlib(backend)
244 matplotlib.rcParams['backend'] = backend
245
--> 246 import matplotlib.pyplot
247 matplotlib.pyplot.switch_backend(backend)
248
/usr/local/lib/python3.4/dist-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 ##############
/usr/local/lib/python3.4/dist-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
/usr/lib/python3/dist-packages/IPython/terminal/interactiveshell.py in enable_gui(gui, app)
306 from IPython.lib.inputhook import enable_gui as real_enable_gui
307 try:
--> 308 return real_enable_gui(gui, app)
309 except ValueError as e:
310 raise UsageError("%s" % e)
/usr/lib/python3/dist-packages/IPython/lib/inputhook.py in enable_gui(gui, app)
526 e = "Invalid GUI request %r, valid ones are:%s" % (gui, list(guis.keys()))
527 raise ValueError(e)
--> 528 return gui_hook(app)
529
/usr/lib/python3/dist-packages/IPython/lib/inputhook.py in enable_tk(self, app)
322 if app is None:
323 import tkinter
--> 324 app = tkinter.Tk()
325 app.withdraw()
326 self._apps[GUI_TK] = app
/usr/lib/python3.4/tkinter/__init__.py in __init__(self, screenName, baseName, className, useTk, sync, use)
1852 baseName = baseName + ext
1853 interactive = 0
-> 1854 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
1855 if useTk:
1856 self._loadtk()
TclError: no display name and no $DISPLAY environment variable
I'd appreciate if anybody can point out how to remove this error. Thank you.
There is no official display environment for bash on Windows.
You need to install unoffical display environment, i.e. xming (https://sourceforge.net/projects/xming/)
After installing xming you need to export as DISPLAY=:0.
You also need to install qtconsole. sudo apt-get install qtconsole
However, I don't suggest going in this way, there is a much easier way for using ipython on Windows. You can install Anaconda on Windows and you can use ipython without any problems like this (https://www.continuum.io/downloads)
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.