Skip to content

Instantly share code, notes, and snippets.

@analog-io
Created October 27, 2015 16:01
Show Gist options
  • Save analog-io/1c1aeaee9a6e9398b699 to your computer and use it in GitHub Desktop.
Save analog-io/1c1aeaee9a6e9398b699 to your computer and use it in GitHub Desktop.
when entering %pylab into jupyter notebook
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-4ab7ec3413a5> in <module>()
----> 1 get_ipython().magic('pylab')
/root/anaconda3/lib/python3.4/site-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
2334 magic_name, _, magic_arg_s = arg_s.partition(' ')
2335 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2336 return self.run_line_magic(magic_name, magic_arg_s)
2337
2338 #-------------------------------------------------------------------------
/root/anaconda3/lib/python3.4/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line)
2255 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2256 with self.builtin_trap:
-> 2257 result = fn(*args,**kwargs)
2258 return result
2259
/root/anaconda3/lib/python3.4/site-packages/IPython/core/magics/pylab.py in pylab(self, line)
/root/anaconda3/lib/python3.4/site-packages/IPython/core/magic.py 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):
/root/anaconda3/lib/python3.4/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")
/root/anaconda3/lib/python3.4/site-packages/IPython/core/interactiveshell.py in enable_pylab(self, gui, import_all, welcome_message)
3169 from IPython.core.pylabtools import import_pylab
3170
-> 3171 gui, backend = self.enable_matplotlib(gui)
3172
3173 # We want to prevent the loading of pylab to pollute the user's
/root/anaconda3/lib/python3.4/site-packages/IPython/core/interactiveshell.py in enable_matplotlib(self, gui)
3130 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select)
3131
-> 3132 pt.activate_matplotlib(backend)
3133 pt.configure_inline_support(self, backend)
3134
/root/anaconda3/lib/python3.4/site-packages/IPython/core/pylabtools.py in activate_matplotlib(backend)
272 matplotlib.rcParams['backend'] = backend
273
--> 274 import matplotlib.pyplot
275 matplotlib.pyplot.switch_backend(backend)
276
/root/anaconda3/lib/python3.4/site-packages/matplotlib/pyplot.py in <module>()
107
108 from matplotlib.backends import pylab_setup
--> 109 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
110
111
/root/anaconda3/lib/python3.4/site-packages/matplotlib/backends/__init__.py in pylab_setup()
30 # imports. 0 means only perform absolute imports.
31 backend_mod = __import__(backend_name,
---> 32 globals(),locals(),[backend_name],0)
33
34 # Things we pull in from all backends
/root/anaconda3/lib/python3.4/site-packages/matplotlib/backends/backend_qt4agg.py in <module>()
15 from matplotlib.figure import Figure
16
---> 17 from .backend_qt5agg import NavigationToolbar2QTAgg
18 from .backend_qt5agg import FigureCanvasQTAggBase
19
/root/anaconda3/lib/python3.4/site-packages/matplotlib/backends/backend_qt5agg.py in <module>()
16
17 from .backend_agg import FigureCanvasAgg
---> 18 from .backend_qt5 import QtCore
19 from .backend_qt5 import QtGui
20 from .backend_qt5 import FigureManagerQT
/root/anaconda3/lib/python3.4/site-packages/matplotlib/backends/backend_qt5.py in <module>()
29 figureoptions = None
30
---> 31 from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
32 from matplotlib.backends.qt_editor.formsubplottool import UiSubplotTool
33
/root/anaconda3/lib/python3.4/site-packages/matplotlib/backends/qt_compat.py in <module>()
89 if QT_API in [QT_API_PYQT, QT_API_PYQTv2]: # PyQt4 API
90
---> 91 from PyQt4 import QtCore, QtGui
92
93 try:
ImportError: libSM.so.6: cannot open shared object file: No such file or directory
@analog-io
Copy link
Author

for all of the lonely people out there banging their head against the wall on this issue (like myself) the solution is:

conda/conda#1051

apt-get install libsm6 libxrender1 libfontconfig1

conda install system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment