Skip to content

%matplotlib notebook broken in 2.2.2 on linux. Works in 2.0.2. #11368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chrisgmorton opened this issue Jun 2, 2018 · 7 comments
Closed

%matplotlib notebook broken in 2.2.2 on linux. Works in 2.0.2. #11368

chrisgmorton opened this issue Jun 2, 2018 · 7 comments

Comments

@chrisgmorton
Copy link

Bug report

Bug summary

See title.

Code for reproduction

See title.

Actual outcome

Plots are displayed outside browser window and not inline. This is specific to 2.2.2 with Linux, works on OSX. Also works on both OS platforms in 2.0.2.

Expected outcome

Dynamic plots should appear inline in the browser.

Matplotlib version

  • Operating system: OSX 10.13.4, Ubuntu 16.04
  • Matplotlib version: 2.2.2
  • Matplotlib backend Qt5Agg
  • Python version: 3.6.4
  • Jupyter version (if applicable): 4.4
  • Other libraries:

Installation with pip.

@ImportanceOfBeingErnest
Copy link
Member

Seems to be the same as yesterday's #11365. Did anything else change outside of matplotlib recently such that this would suddenly come up twice within less than a day?

@tacaswell
Copy link
Member

How are you starting the notebook server?

@chrisgmorton
Copy link
Author

Starting from a bash script:

#!/usr/bin/env bash
export PYTHONSTARTUP=path/to/my_init.ipy
jupyter notebook

and the my_init.ipy file is

%matplotlib notebook

@chrisgmorton
Copy link
Author

This is not likely due to a dependency as I can get rid of the problem by switching back from 2.2.2 to 2.0.2 using a pip3 uninstall and then pip3 install matplotlib==2.0.2. Everything else in my installation remains unchanged.

@tacaswell
Copy link
Member

If you start up without your init script does it work as expected?

@chrisgmorton
Copy link
Author

chrisgmorton commented Jun 4, 2018

This is my fault. When installing 2.0.2, I have to modify backends/backend_nbagg.py by adding

def flush_events(self): pass

to the FigureCanvasNbAgg class to work around the NotImplementedError exception that is encountered in the parent class virtual method. I was rather carelessly adding the same line to the 2.2.2 version of the file, following installation, which was landing in the wrong place. This caused aa visible error message when manually typing %matplotlib notebook at the notebook prompt.

Looks like code has changed in 2.2.2 so that we don't get this exception any longer. I didn't dig in further as to why.

@tacaswell
Copy link
Member

Glad that got sorted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants