Skip to content

DeprecationWarning: Passing unrecognized arguments to super(Toolbar).__init__(). #611

@Firestar-Reimu

Description

@Firestar-Reimu

Describe the issue

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
File ~/.miniforge/lib/python3.13/site-packages/traitlets/traitlets.py:1379, in HasTraits.__init__(self, *args, **kwargs)
   1378 try:
-> [1379](https://file+.vscode-resource.vscode-cdn.net/home/firestar/NAOC/HVC-catalog/Test/~/.miniforge/lib/python3.13/site-packages/traitlets/traitlets.py:1379)     super().__init__(*super_args, **super_kwargs)
   1380 except TypeError as e:

TypeError: NavigationToolbar2WebAgg.__init__() missing 1 required positional argument: 'canvas'

During handling of the above exception, another exception occurred:

DeprecationWarning                        Traceback (most recent call last)
Cell In[24], [line 4](vscode-notebook-cell:?execution_count=24&line=4)
      2 cluster_id = hvc_candidates[i]
      3 moment_0_crop, extent, xc, yc, a, b, theta, area = cluster_params[i]
----> [4](vscode-notebook-cell:?execution_count=24&line=4) fig, ax = plt.subplots(1, 2, figsize=[10, 4])
      5 im = ax[0].imshow(
      6     moment_0_crop,
      7     extent=extent,
   (...)     10     interpolation="none",
     11 )
     12 cs = ax[0].contour(
     13     moment_0_crop,
     14     levels=[0.5 * np.max(moment_0_crop)],
   (...)     18     linestyles="solid",
     19 )

File ~/.miniforge/lib/python3.13/site-packages/matplotlib/pyplot.py:1776, in subplots(nrows, ncols, sharex, sharey, squeeze, width_ratios, height_ratios, subplot_kw, gridspec_kw, **fig_kw)
   1621 def subplots(
   1622     nrows: int = 1, ncols: int = 1, *,
   1623     sharex: bool | Literal["none", "all", "row", "col"] = False,
   (...)   1630     **fig_kw
   1631 ) -> tuple[Figure, Any]:
   1632     """
   1633     Create a figure and a set of subplots.
   1634 
   (...)   1774 
   1775     """
-> [1776](https://file+.vscode-resource.vscode-cdn.net/home/firestar/NAOC/HVC-catalog/Test/~/.miniforge/lib/python3.13/site-packages/matplotlib/pyplot.py:1776)     fig = figure(**fig_kw)
   1777     axs = fig.subplots(nrows=nrows, ncols=ncols, sharex=sharex, sharey=sharey,
   1778                        squeeze=squeeze, subplot_kw=subplot_kw,
   1779                        gridspec_kw=gridspec_kw, height_ratios=height_ratios,
   1780                        width_ratios=width_ratios)
   1781     return fig, axs

File ~/.miniforge/lib/python3.13/site-packages/matplotlib/pyplot.py:1041, in figure(num, figsize, dpi, facecolor, edgecolor, frameon, FigureClass, clear, **kwargs)
   1031 if len(allnums) == max_open_warning >= 1:
   1032     _api.warn_external(
   1033         f"More than {max_open_warning} figures have been opened. "
   1034         f"Figures created through the pyplot interface "
   (...)   1038         f"Consider using `matplotlib.pyplot.close()`.",
   1039         RuntimeWarning)
-> [1041](https://file+.vscode-resource.vscode-cdn.net/home/firestar/NAOC/HVC-catalog/Test/~/.miniforge/lib/python3.13/site-packages/matplotlib/pyplot.py:1041) manager = new_figure_manager(
   1042     num, figsize=figsize, dpi=dpi,
   1043     facecolor=facecolor, edgecolor=edgecolor, frameon=frameon,
   1044     FigureClass=FigureClass, **kwargs)
   1045 fig = manager.canvas.figure
   1046 if fig_label:

File ~/.miniforge/lib/python3.13/site-packages/matplotlib/pyplot.py:551, in new_figure_manager(*args, **kwargs)
    549 """Create a new figure manager instance."""
    550 _warn_if_gui_out_of_main_thread()
--> [551](https://file+.vscode-resource.vscode-cdn.net/home/firestar/NAOC/HVC-catalog/Test/~/.miniforge/lib/python3.13/site-packages/matplotlib/pyplot.py:551) return _get_backend_mod().new_figure_manager(*args, **kwargs)

File ~/.miniforge/lib/python3.13/site-packages/matplotlib/backend_bases.py:3504, in _Backend.new_figure_manager(cls, num, *args, **kwargs)
   3502 fig_cls = kwargs.pop('FigureClass', Figure)
   3503 fig = fig_cls(*args, **kwargs)
-> [3504](https://file+.vscode-resource.vscode-cdn.net/home/firestar/NAOC/HVC-catalog/Test/~/.miniforge/lib/python3.13/site-packages/matplotlib/backend_bases.py:3504) return cls.new_figure_manager_given_figure(num, fig)

File ~/.miniforge/lib/python3.13/site-packages/ipympl/backend_nbagg.py:430, in _Backend_ipympl.new_figure_manager_given_figure(num, figure)
    428 if 'nbagg.transparent' in rcParams and rcParams['nbagg.transparent']:
    429     figure.patch.set_alpha(0)
--> [430](https://file+.vscode-resource.vscode-cdn.net/home/firestar/NAOC/HVC-catalog/Test/~/.miniforge/lib/python3.13/site-packages/ipympl/backend_nbagg.py:430) manager = FigureManager(canvas, num)
    432 if is_interactive():
    433     _Backend_ipympl._to_show.append(figure)

File ~/.miniforge/lib/python3.13/site-packages/ipympl/backend_nbagg.py:402, in FigureManager.__init__(self, canvas, num)
    400 FigureManagerWebAgg.__init__(self, canvas, num)
    401 self.web_sockets = [self.canvas]
--> [402](https://file+.vscode-resource.vscode-cdn.net/home/firestar/NAOC/HVC-catalog/Test/~/.miniforge/lib/python3.13/site-packages/ipympl/backend_nbagg.py:402) self.toolbar = Toolbar(self.canvas)

File ~/.miniforge/lib/python3.13/site-packages/ipympl/backend_nbagg.py:126, in Toolbar.__init__(self, canvas, *args, **kwargs)
    125 def __init__(self, canvas, *args, **kwargs):
--> [126](https://file+.vscode-resource.vscode-cdn.net/home/firestar/NAOC/HVC-catalog/Test/~/.miniforge/lib/python3.13/site-packages/ipympl/backend_nbagg.py:126)     DOMWidget.__init__(self, *args, **kwargs)
    127     NavigationToolbar2WebAgg.__init__(self, canvas, *args, **kwargs)
    129     self.on_msg(self.canvas._handle_message)

File ~/.miniforge/lib/python3.13/site-packages/ipywidgets/widgets/widget.py:503, in Widget.__init__(self, **kwargs)
    501 """Public constructor"""
    502 self._model_id = kwargs.pop('model_id', None)
--> [503](https://file+.vscode-resource.vscode-cdn.net/home/firestar/NAOC/HVC-catalog/Test/~/.miniforge/lib/python3.13/site-packages/ipywidgets/widgets/widget.py:503) super().__init__(**kwargs)
    505 Widget._call_widget_constructed(self)
    506 self.open()

File ~/.miniforge/lib/python3.13/site-packages/traitlets/traitlets.py:1385, in HasTraits.__init__(self, *args, **kwargs)
   1383     arg_s_list.append(f"{k}={v!r}")
   1384 arg_s = ", ".join(arg_s_list)
-> [1385](https://file+.vscode-resource.vscode-cdn.net/home/firestar/NAOC/HVC-catalog/Test/~/.miniforge/lib/python3.13/site-packages/traitlets/traitlets.py:1385) warn(
   1386     "Passing unrecognized arguments to super({classname}).__init__({arg_s}).\n"
   1387     "{error}\n"
   1388     "This is deprecated in traitlets 4.2."
   1389     "This error will be raised in a future release of traitlets.".format(
   1390         arg_s=arg_s,
   1391         classname=self.__class__.__name__,
   1392         error=e,
   1393     ),
   1394     DeprecationWarning,
   1395     stacklevel=2,
   1396 )

File ~/.miniforge/lib/python3.13/site-packages/traitlets/utils/warnings.py:14, in warn(msg, category, stacklevel, source)
      9 def warn(msg: str, category: t.Any, *, stacklevel: int, source: t.Any = None) -> None:
     10     """Like warnings.warn(), but category and stacklevel are required.
     11 
     12     You pretty much never want the default stacklevel of 1, so this helps
     13     encourage setting it explicitly."""
---> [14](https://file+.vscode-resource.vscode-cdn.net/home/firestar/NAOC/HVC-catalog/Test/~/.miniforge/lib/python3.13/site-packages/traitlets/utils/warnings.py:14)     warnings.warn(msg, category=category, stacklevel=stacklevel, source=source)

DeprecationWarning: Passing unrecognized arguments to super(Toolbar).__init__().
NavigationToolbar2WebAgg.__init__() missing 1 required positional argument: 'canvas'
This is deprecated in traitlets 4.2.This error will be raised in a future release of traitlets.

Versions

 3.13.11 | packaged by conda-forge | (main, Dec  6 2025, 11:24:03) [GCC 14.3.0]
ipympl version: 0.9.8
Selected Jupyter core packages...
IPython          : 9.8.0
ipykernel        : 7.1.0
ipywidgets       : 8.1.8
jupyter_client   : 8.7.0
jupyter_core     : 5.9.1
jupyter_server   : 2.17.0
jupyterlab       : not installed
nbclient         : 0.10.4
nbconvert        : 7.16.6
nbformat         : 5.10.4
notebook         : not installed
qtconsole        : not installed
traitlets        : 5.14.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions