Notebook: jupyter notebook cannot use osx backend (matplotlib)

Created on 20 Oct 2017  路  7Comments  路  Source: jupyter/notebook

jupyter notebook (and console) cannot use osx backend (matplotlib).

I have had this problem on and off over many versions of osx, and usually it was related to virtual envs.
I now use python3 venv,
python: 3.6.1
jupyter-client (5.1.0)
MacOS: HighSierra

No errors are emitted, figures simply fail to open.
inline works, other backends (e.g. agg) work, but are not interactive.

ipython with osx backend works fine

Most helpful comment

I have the same problem:

The osx backend produces interactive figures no problem running from IPython in the terminal:

image

Loading the osx backend in a jupyter notebook doesn't complain in the notebook:

image

but in the terminal running jupyter:

ERROR:tornado.application:Exception in callback functools.partial(.null_wrapper at 0x1139c4c80>)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/tornado/ioloop.py", line 605, in _run_callback
ret = callback()
File "/usr/local/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(args, *kwargs)
File "/usr/local/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 262, in enter_eventloop
self.eventloop(self)
File "/usr/local/lib/python3.6/site-packages/ipykernel/eventloops.py", line 278, in loop_cocoa
show.mainloop()
AttributeError: 'function' object has no attribute 'mainloop'

If I go ahead and try to create a figure, the python rocket bounces in the dock forever but no figure appears.

Setup:

  • Python 3.6.4 (homebrew)
  • IPython 6.5.0
  • Matplotlib 2.2.3
  • jupyter 4.4.0

All 7 comments

Have you tried other interactive backends like qtagg? E.g. %matplotlib qt5.

Only tk and inline work -- but tk is very clunky, which is why I wanted the osx backend to work again
I couldn't get qt5 to work because pyside does not support python 3.6.1

OK. One of the mac users will have to help you debugging the osx backend.

I have the same issue.

I have the same/similar issue: in ipython it works, but not in jupyter console or jupyter notebook or jupyter lab. In the notebook and lab, no error occurs, the window just would not open, but in jupyter console, I get the following error when I type in %matplotlib:

ERROR:tornado.application:Exception in callback functools.partial(<function wrap.<locals>.null_wrapper at 0xa166c7ea0>)
Traceback (most recent call last):
  File "/Users/USER/anaconda3/lib/python3.6/site-packages/tornado/ioloop.py", line 605, in _run_callback
    ret = callback()
  File "/Users/USER/anaconda3/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "/Users/USER/anaconda3/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 265, in enter_eventloop
    self.eventloop(self)
  File "/Users/USER/anaconda3/lib/python3.6/site-packages/ipykernel/eventloops.py", line 277, in loop_cocoa
    show.mainloop()
AttributeError: 'function' object has no attribute 'mainloop'
Using matplotlib backend: MacOSX

I use:

  • Python 3.6.3 |Anaconda custom (64-bit)| (default, Feb 12 2018, 00:33:07)
  • IPython 6.1.0
  • jupyter 4.3.0
  • matplotlib 2.1.1

I have the same problem:

The osx backend produces interactive figures no problem running from IPython in the terminal:

image

Loading the osx backend in a jupyter notebook doesn't complain in the notebook:

image

but in the terminal running jupyter:

ERROR:tornado.application:Exception in callback functools.partial(.null_wrapper at 0x1139c4c80>)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/tornado/ioloop.py", line 605, in _run_callback
ret = callback()
File "/usr/local/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(args, *kwargs)
File "/usr/local/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 262, in enter_eventloop
self.eventloop(self)
File "/usr/local/lib/python3.6/site-packages/ipykernel/eventloops.py", line 278, in loop_cocoa
show.mainloop()
AttributeError: 'function' object has no attribute 'mainloop'

If I go ahead and try to create a figure, the python rocket bounces in the dock forever but no figure appears.

Setup:

  • Python 3.6.4 (homebrew)
  • IPython 6.5.0
  • Matplotlib 2.2.3
  • jupyter 4.4.0

I believe I solved this issue back when by installing pyside with brew. The drawback is llvm is also installed (as a brew dependency on pysie), which takes up some 3gb of disk.

Was this page helpful?
0 / 5 - 0 ratings