python - Failure to import matplotlib.pyplot in jupyter (but not ipython) -


update: ipykeynel 4.4.1 patched issue morning of aug 9.

i have fresh install , have been trying python dependencies , running, namely jupyter notebook , matplotlib. i've pip installed everything, , "import matplotlib" works. if in jupyter notebook, , try "import matplotlib.pyplot" or "from matplotlib import pyplot plt", get:

importerror                               traceback (most recent call last) ... /usr/local/lib/python2.7/dist-packages/ipython/core/pylabtools.pyc in configure_inline_support(shell, backend)     359     except importerror:     360         return --> 361     matplotlib import pyplot     362     363     cfg = inlinebackend.instance(parent=shell)  importerror: cannot import name pyplot 

full traceback

however, if in ipython (command line), works fine. also, running plots module command line, fine. have tried variety of techniques:

  • pip install / uninstall matplotlib, ipython, , jupyter in various order
  • using pip --no-cache-dir and/or --ignore-installed
  • deleting ~/.cache, ~/.ipython , ~/.jupyter
  • making sure no packages installed apt-get, installed pip
  • using apt-get install python-matplotlib, ipython, , python-jupyter

it feels have mangled sort of path information, cannot locate or cause this, after multiple pip uninstall/reinstall , cache clearing. i've read every question relating importing matplotlib, none have been helpful.

i rolled matplotlib 1.4.3, , worked, lacks couple of features need. realize tricky one, if have insight, if incomplete, appreciated. also, if worthy of bug report (never done one, not sure if matplotlib problem, or locally goofed up), comment such , i'll submit one. thanks!

system info:

linux mint 18 "sarah" python==2.7.12 ipykernel==4.4.0 ipython==5.0.0 ipython-genutils==0.1.0 ipywidgets==5.2.2 jupyter==1.0.0 jupyter-client==4.3.0 jupyter-console==5.0.0 jupyter-core==4.1.0 notebook==4.2.2 numpy==1.11.1 pip 8.1.2 /usr/local/lib/python2.7/dist-packages (python 2.7) 

output of sys.path in ipython , jupyter (same both):

['',  '/usr/local/bin',  '/usr/lib/python2.7',  '/usr/lib/python2.7/plat-x86_64-linux-gnu',  '/usr/lib/python2.7/lib-tk',  '/usr/lib/python2.7/lib-old',  '/usr/lib/python2.7/lib-dynload',  '/usr/local/lib/python2.7/dist-packages',  '/usr/lib/python2.7/dist-packages',  '/usr/lib/python2.7/dist-packages/pilcompat',  '/usr/lib/python2.7/dist-packages/gtk-2.0',  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',  '/usr/local/lib/python2.7/dist-packages/ipython/extensions',  '/home/mm/.ipython'] 

i have same problem, , problem maybe produced ipykernel. after roll ipykernel version 4.3.1. problem solved.

just @igor raush said, it's import circular of matplotlib.pyplot.


Comments