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

Skip to content

matplotlib bug in WinPython 2025-02 final Spyder Ipython console #1587

Closed
@urima

Description

@urima

Just type "%pylab" in ipython console or click the "Inline" on the statusbar.

Here is what I got:

Python 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 8.34.0 -- An enhanced Interactive Python. Type '?' for help.

%pylab

ValueError Traceback (most recent call last)
Cell In[1], line 1
----> 1 get_ipython().run_line_magic('pylab', '')

File C:\winPython\WPy64-312100\python\Lib\site-packages\IPython\core\interactiveshell.py:2482, in InteractiveShell.run_line_magic(self, magic_name, line, _stack_depth)
2480 kwargs['local_ns'] = self.get_local_scope(stack_depth)
2481 with self.builtin_trap:
-> 2482 result = fn(*args, **kwargs)
2484 # The code below prevents the output from being displayed
2485 # when using magics with decorator @output_can_be_silenced
2486 # when the last Python token in the expression is a ';'.
2487 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File C:\winPython\WPy64-312100\python\Lib\site-packages\IPython\core\magics\pylab.py:159, in PylabMagics.pylab(self, line)
155 else:
156 # invert no-import flag
157 import_all = not args.no_import_all
--> 159 gui, backend, clobbered = self.shell.enable_pylab(args.gui, import_all=import_all)
160 self._show_matplotlib_backend(args.gui, backend)
161 print(
162 "%pylab is deprecated, use %matplotlib inline and import the required libraries."
163 )

File C:\winPython\WPy64-312100\python\Lib\site-packages\IPython\core\interactiveshell.py:3721, in InteractiveShell.enable_pylab(self, gui, import_all, welcome_message)
3694 """Activate pylab support at runtime.
3695
3696 This turns on support for matplotlib, preloads into the interactive
(...)
3717 This argument is ignored, no welcome message will be displayed.
3718 """
3719 from IPython.core.pylabtools import import_pylab
-> 3721 gui, backend = self.enable_matplotlib(gui)
3723 # We want to prevent the loading of pylab to pollute the user's
3724 # namespace as shown by the %who* magics, so we execute the activation
3725 # code in an empty namespace, and we update both user_ns and
3726 # user_ns_hidden with this information.
3727 ns = {}

File C:\winPython\WPy64-312100\python\Lib\site-packages\IPython\core\interactiveshell.py:3683, in InteractiveShell.enable_matplotlib(self, gui)
3679 pt.activate_matplotlib(backend)
3681 from matplotlib_inline.backend_inline import configure_inline_support
-> 3683 configure_inline_support(self, backend)
3685 # Now we must activate the gui pylab wants to use, and fix %run to take
3686 # plot updates into account
3687 self.enable_gui(gui)

File C:\winPython\WPy64-312100\python\Lib\site-packages\matplotlib_inline\backend_inline.py:205, in configure_inline_support(shell, backend)
202 cur_backend = getattr(configure_inline_support, "current_backend", "unset")
203 if new_backend_name != cur_backend:
204 # Setup the default figure format
--> 205 select_figure_formats(shell, cfg.figure_formats, **cfg.print_figure_kwargs)
206 configure_inline_support.current_backend = new_backend_name

File C:\winPython\WPy64-312100\python\Lib\site-packages\IPython\core\pylabtools.py:297, in select_figure_formats(shell, formats, **kwargs)
295 bs = "%s" % ','.join([repr(f) for f in bad])
296 gs = "%s" % ','.join([repr(f) for f in supported])
--> 297 raise ValueError("supported formats are: %s not %s" % (gs, bs))
299 if "png" in formats:
300 png_formatter.for_type(
301 Figure, partial(print_figure, fmt="png", base64=True, **kwargs)
302 )

ValueError: supported formats are: 'jpg','jpeg','png2x','png','retina','svg','pdf' not 'p','g','n'

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