Skip to content

No longer able to import ipympl.nbagg_backend #363

@pelson

Description

@pelson

Describe the issue

No longer able to import ipympl.nbagg_backend since recent version updates.

I was previously using ipympl.backend_nbagg.new_figure_manager_given_figure to create a figure manager after having created one via mpl's OO API. The exception is:

$ python -c "import ipympl.backend_nbagg"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/clean_py39/lib/python3.9/site-packages/ipympl/backend_nbagg.py", line 431, in <module>
    ip.events.register('post_execute', flush_figures)
AttributeError: 'NoneType' object has no attribute 'events'

Is this an unexpected issue, or by design?

Versions

Please include the result of the following command, which will print out the version of python, ipympl and the Jupyter ecosystem.

python -c "import sys; print('\n',sys.version); import ipympl; print('ipympl version:', ipympl.__version__)" && jupyter --version && jupyter nbextension list && jupyter labextension list

-->

$ python -c "import sys; print('\n',sys.version); import ipympl; print('ipympl version:', ipympl.__version__)" && jupyter --version && jupyter nbextension list && jupyter labextension list

 3.9.7 | packaged by conda-forge | (default, Sep 23 2021, 07:28:37) 
[GCC 9.4.0]
ipympl version: 0.8.0
Selected Jupyter core packages...
IPython          : 7.28.0
ipykernel        : 6.4.1
ipywidgets       : 7.6.5
jupyter_client   : 7.0.3
jupyter_core     : 4.8.1
jupyter_server   : not installed
jupyterlab       : not installed
nbclient         : 0.5.4
nbconvert        : 6.2.0
nbformat         : 5.1.3
notebook         : 6.4.4
qtconsole        : not installed
traitlets        : 5.1.0
Known nbextensions:
  config dir: /tmp/clean_py39/etc/jupyter/nbconfig
    notebook section
      jupyter-matplotlib/extension  enabled 
      - Validating: OK
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
usage: jupyter [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir] [--paths] [--json] [--debug] [subcommand]

Jupyter: Interactive Computing

positional arguments:
  subcommand     the subcommand to launch

optional arguments:
  -h, --help     show this help message and exit
  --version      show the versions of core jupyter packages and exit
  --config-dir   show Jupyter config dir
  --data-dir     show Jupyter data dir
  --runtime-dir  show Jupyter runtime dir
  --paths        show all Jupyter paths. Add --json for machine-readable format.
  --json         output paths as machine-readable json
  --debug        output debug information about paths

Available subcommands: bundlerextension dejavu kernel kernelspec migrate nbconvert nbextension notebook run serverextension troubleshoot trust

Jupyter command `jupyter-labextension` not found.

I was able to reproduce this quickly with:

$ mamba create -p /tmp/clean_py39 python=3.9 -c conda-forge


$ conda activate /tmp/clean_py39/
$ pip install ipympl
$ pip list 
Package             Version
------------------- -------
argon2-cffi         21.1.0
attrs               21.2.0
backcall            0.2.0
bleach              4.1.0
cffi                1.14.6
cycler              0.10.0
debugpy             1.4.3
decorator           5.1.0
defusedxml          0.7.1
entrypoints         0.3
ipykernel           6.4.1
ipympl              0.8.0
ipython             7.28.0
ipython-genutils    0.2.0
ipywidgets          7.6.5
jedi                0.18.0
Jinja2              3.0.1
jsonschema          3.2.0
jupyter-client      7.0.3
jupyter-core        4.8.1
jupyterlab-pygments 0.1.2
jupyterlab-widgets  1.0.2
kiwisolver          1.3.2
MarkupSafe          2.0.1
matplotlib          3.4.3
matplotlib-inline   0.1.3
mistune             0.8.4
nbclient            0.5.4
nbconvert           6.2.0
nbformat            5.1.3
nest-asyncio        1.5.1
notebook            6.4.4
numpy               1.21.2
packaging           21.0
pandocfilters       1.5.0
parso               0.8.2
pexpect             4.8.0
pickleshare         0.7.5
Pillow              8.3.2
pip                 21.2.4
prometheus-client   0.11.0
prompt-toolkit      3.0.20
ptyprocess          0.7.0
pycparser           2.20
Pygments            2.10.0
pyparsing           2.4.7
pyrsistent          0.18.0
python-dateutil     2.8.2
pyzmq               22.3.0
Send2Trash          1.8.0
setuptools          58.0.4
six                 1.16.0
terminado           0.12.1
testpath            0.5.0
tornado             6.1
traitlets           5.1.0
wcwidth             0.2.5
webencodings        0.5.1
wheel               0.37.0
widgetsnbextension  3.5.1
$ python -c "import ipympl.backend_nbagg"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/clean_py39/lib/python3.9/site-packages/ipympl/backend_nbagg.py", line 431, in <module>
    ip.events.register('post_execute', flush_figures)
AttributeError: 'NoneType' object has no attribute 'events'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions