c.InteractiveShellApp.matplotlib='auto' breaks %matplotlib notebook

48 views
Skip to first unread message

Juan Nunez-Iglesias

unread,
May 27, 2017, 9:13:46 PM5/27/17
to Project Jupyter
Hi,

I mostly use the IPython terminal when doing exploratory data analysis with Python. I used to call `ipython --matplotlib` each time until I found the `c.InteractiveShellApp.matplotlib = 'auto'` setting in ipython_config.py. However, now when I run a Jupyter notebook, if I try to use %matplotlib notebook, I get the error message:

Warning: Cannot change to a different GUI toolkit: notebook. Using osx instead.

Is there a way to specify that I only want the 'auto' setting for the IPython terminal, *not* for Jupyter kernels?

Thanks!

Juan.

Mike Pacer

unread,
May 27, 2017, 9:26:41 PM5/27/17
to jup...@googlegroups.com
I'm guessing you can probably set it at a more specific level, but I'm not sure off the top of my head.

But I can suggest an alternative solution. Use matplotlib 2+ and it's matplotlib.pyplot.ion() function. Doing that should not require you to specify any particular backend. It also makes your notebooks easier to export to a valid script.

Cheers,
M


--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/7b117721-9f9b-47eb-b302-463f404db285%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthias Bussonnier

unread,
May 27, 2017, 11:20:37 PM5/27/17
to jup...@googlegroups.com
M is right, you can use --TerminalIPythonApp.matplotlib that should
apply only to the terminal frontend. --IPKernelApp.matplotlib would
apply only to the kernel.

Usually when I have a question like that, I use the following (replace
matplotlib by whatever option you need) to see all the options
available.

$ python -m ipykernel --help-all | grep matplotlib | grep '\-\-' and
$ ipython --help-all | grep matplotlib | grep '\-\-'

all the --UpperCase.lowercase are command line flags with equivalent
c.UpperCase.lowercase you can use in config files.
Obviously the one that appear in both of the above command affect
Terminal and notebook (technically ipykernel) at the same time, those
that appear only in one affect only said command.

--
M (the other one).
> https://groups.google.com/d/msgid/jupyter/CAM3SX47HGyyXiySu9EU1bzFkGCAz_RHO1-5At%2B4V883PqhPgDQ%40mail.gmail.com.

Juan Nunez-Iglesias

unread,
May 29, 2017, 9:22:04 AM5/29/17
to jup...@googlegroups.com
Fixed! Thanks both for your help and thank you Matthias for teaching me to fish. ;)
You received this message because you are subscribed to a topic in the Google Groups "Project Jupyter" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jupyter/yr-whF5dhFQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jupyter+u...@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages