matplotlib_iterm2 icon indicating copy to clipboard operation
matplotlib_iterm2 copied to clipboard

Critical error when setting iterm2 backend

Open jameskyle opened this issue 9 years ago • 5 comments

After entering the recommended profile configuration snippet and installing matplotlib_iterm2 module, I get the following critical error on ipython start:

[TerminalIPythonApp] CRITICAL | Bad config encountered during initialization:
[TerminalIPythonApp] CRITICAL | The 'pylab' trait of a TerminalIPythonApp instance must be any of [u'auto', u'gtk', u'gtk3', u'inline', u'nbagg', u'notebook', u'osx', u'qt', u'qt4', u'qt5', u'tk', u'wx'] or None, but a value of u'iterm2' <type 'unicode'> was specified.

Very similar to the one noted as expected, but mpl simply exits.

jameskyle avatar Feb 19 '16 23:02 jameskyle

  1. What version of iPython/Jupyter do you have?
  2. Can you check if it actually works if it not completely crashes. See https://github.com/oselivanov/matplotlib_iterm2/issues/1

oselivanov avatar Feb 20 '16 03:02 oselivanov

ipython: 4.1.2 jupyter-core: 4.1.0

Here's a full pip freeze from my fresh virtualenv

alabaster==0.7.7 appnope==0.1.0 Babel==2.2.0 backports-abc==0.4 backports.ssl-match-hostname==3.5.0.1 certifi==2016.2.28 cycler==0.10.0 decorator==4.0.9 docutils==0.12 functools32==3.2.3.post2 futures==3.0.5 gnureadline==6.3.3 ipykernel==4.3.1 ipyparallel==5.0.1 ipython==4.1.2 ipython-genutils==0.1.0 ipywidgets==4.1.1 Jinja2==2.8 jsonschema==2.5.1 jupyter-client==4.2.1 jupyter-core==4.1.0 MarkupSafe==0.23 matplotlib==1.5.1 matplotlib-iterm2==0.1.0 mistune==0.7.2 nbconvert==4.1.0 nbformat==4.0.1 nose==1.3.7 notebook==4.1.0 numpy==1.10.4 path.py==8.1.2 pexpect==4.0.1 pickleshare==0.6 Pillow==3.1.1 ptyprocess==0.5.1 Pygments==2.1.3 pyparsing==2.1.0 python-dateutil==2.5.0 pytz==2015.7 pyzmq==15.2.0 qtconsole==4.2.0 requests==2.9.1 simplegeneric==0.8.1 singledispatch==3.4.0.3 six==1.10.0 snowballstemmer==1.2.1 Sphinx==1.3.6 sphinx-rtd-theme==0.1.9 terminado==0.6 testpath==0.3 tornado==4.3 traitlets==4.1.0

jameskyle avatar Mar 09 '16 21:03 jameskyle

Same error still.

isezen avatar Mar 18 '16 23:03 isezen

Same error here, but it looks like you can hack around it by hijacking an existing valid backend key instead of trying to add new key iterm2 (on osx qt and qt4 wfm, but qt5 and gtk fail):

~/.ipython/profile_default/ipython_config.py

# Configuration file for ipython.

c = get_config()

from IPython.core.pylabtools import backends
backends['iterm2'] = 'module://matplotlib_iterm2.backend_iterm2'

from IPython.core.shellapp import backend_keys
backend_keys.append('iterm2')

c.TerminalIPythonApp.pylab = 'iterm2'
$ ipython
...
[TerminalIPythonApp] CRITICAL | Bad config encountered during initialization:
[TerminalIPythonApp] CRITICAL | The 'pylab' trait of a TerminalIPythonApp instance must be any of [u'auto', u'gtk', u'gtk3', u'inline', u'nbagg', u'notebook', u'osx', u'qt', u'qt4', u'qt5', u'tk', u'wx'] or None, but a value of u'iterm2' <type 'unicode'> was specified.

~/.ipython/profile_default/ipython_config.py

# Configuration file for ipython.

c = get_config()

from IPython.core.pylabtools import backends
backends['qt'] = 'module://matplotlib_iterm2.backend_iterm2'

#from IPython.core.shellapp import backend_keys
#backend_keys.append('iterm2')

c.TerminalIPythonApp.pylab = 'qt'
$ ipython
In [1]: from ggplot import *; ggplot(aes(x='date', y='beef'), data=meat) + geom_point()
screen shot 2016-07-18 at 12 15 14

jdanbrown avatar Jul 18 '16 19:07 jdanbrown

@jdanbrown : your solution is confirmed to work in a pyenv 3.5.2 virtual environment

One suggestion for anyone wanting to test this: create a new ipython profile and this will leave the default ipython sessions clean.

    ipython profile create inline

Then edit $HOME/.ipython/profile_inline/ipython_config.py as mentioned by @jdanbrown The matplotlib_iterm2 enabled profile can be tested so:

    ipython --profile=inline

keevee09 avatar Oct 30 '16 04:10 keevee09