Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ipympl version 0.6.3 is incompatible with matplotlib 3.3.4 #303

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
kthare10 opened this issue Feb 23, 2021 · 6 comments · Fixed by #305
Closed

ipympl version 0.6.3 is incompatible with matplotlib 3.3.4 #303

kthare10 opened this issue Feb 23, 2021 · 6 comments · Fixed by #305
Labels

Comments

@kthare10
Copy link

kthare10 commented Feb 23, 2021

Describe the issue

ipympl version 0.6.3 is incompatible with matplotlib 3.3.4

Exception

draw() throws an exception shown below when trying to access _activeQue in matplotlib/_pylab_helpers.py. This member only exists in matplotlib version 3.2.2 and has been removed in version 3.3.*

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-a2dfa485d491> in <module>
      7 t.nodes['n2'].add_component(ctype=fu.ComponentType.SharedNIC, model='ConnectX-6', name='nic2')
      8 t.add_link(name='l1', interfaces=list(t.interfaces.values()), ltype=fu.LinkType.Wave)
----> 9 t.draw()
     10 t.draw(topo_detail=fu.TopologyDetail.Derived)
/opt/conda/lib/python3.8/site-packages/fim/user/topology.py in draw(self, file_name, interactive, topo_detail, layout)
    300             nx.draw_networkx(derived_graph, pos=pos)
    301             if not interactive:
--> 302                 plt.show()
    303             if file_name is not None:
    304                 plt.savefig(file_name)
/opt/conda/lib/python3.8/site-packages/matplotlib/pyplot.py in show(*args, **kwargs)
    351     """
    352     _warn_if_gui_out_of_main_thread()
--> 353     return _backend_mod.show(*args, **kwargs)
    354 
    355 
/opt/conda/lib/python3.8/site-packages/ipympl/backend_nbagg.py in __call__(self, block)
     54                 manager.canvas.mpl_disconnect(manager._cidgcf)
     55 
---> 56             if not interactive and manager in Gcf._activeQue:
     57                 Gcf._activeQue.remove(manager)
     58 
AttributeError: type object 'Gcf' has no attribute '_activeQue'

Versions

python -c "import sys; print('\n',sys.version); import ipympl; print('ipympl version:', ipympl.version)" && jupyter --version && jupyter nbextension list && jupyter labextension list
3.8.6 | packaged by conda-forge | (default, Dec 26 2020, 05:05:16)
[GCC 9.3.0]
ipympl version: 0.6.3
jupyter core : 4.7.1
jupyter-notebook : 6.2.0
qtconsole : not installed
ipython : 7.20.0
ipykernel : 5.4.2
jupyter client : 6.1.11
jupyter lab : 3.0.5
nbconvert : 6.0.7
ipywidgets : 7.6.3
nbformat : 5.1.2
traitlets : 5.0.5
Known nbextensions:
config dir: /opt/conda/etc/jupyter/nbconfig
notebook section
jupyter-matplotlib/extension enabled
- Validating: OK
nbresuse/main enabled
- Validating: OK
jupyter-js-widgets/extension enabled
- Validating: OK
JupyterLab v3.0.5
/opt/conda/share/jupyter/labextensions
jupyter-matplotlib v0.8.3 enabled OK
@jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)

Other labextensions (built into JupyterLab)
app dir: /opt/conda/share/jupyter/lab
jupyterlab-sos v0.8.0 enabled OK
transient-display-data v0.4.1 enabled OK

@ianhi
Copy link
Collaborator

ianhi commented Feb 24, 2021

Indeed Gcf._activeQue no longer seems to exist in https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/_pylab_helpers.py

That said I wasn't able to replicate the error. @kthare10 can you please post a small complete test case that causes this error?(it should contain all necessary imports etc) .

@ianhi
Copy link
Collaborator

ianhi commented Feb 24, 2021

The fix is probably to take the current version from the nbagg backend which can be found here: https://github.com/matplotlib/matplotlib/blob/a510e32a37a8b4e0bc4e8384df20c7b45abd9913/lib/matplotlib/backends/backend_nbagg.py#L246

@ianhi ianhi added the bug label Feb 24, 2021
@ianhi
Copy link
Collaborator

ianhi commented Feb 24, 2021

I realized why I couldn't reproduce, I was misled by the draw in the traceback. A small reproduction case is:

%matplotlib ipympl
import matplotlib.pyplot as plt
plt.ioff()
plt.figure()
plt.show()

@ianhi
Copy link
Collaborator

ianhi commented Feb 24, 2021

As a workarond @kthare10 you can set set interactive mode to true with plt.ion() and the error should be resolved.

@ianhi
Copy link
Collaborator

ianhi commented Mar 1, 2021

@kthare10 see #305 for a fix

@kthare10
Copy link
Author

kthare10 commented Mar 1, 2021

Thanks! Appreciate it!

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

Successfully merging a pull request may close this issue.

2 participants