-
Notifications
You must be signed in to change notification settings - Fork 315
matplotlib bug in WinPython 2025-02 final Spyder Ipython console #1587
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
Comments
161 print( |
Does it work better with %matplotlib inline? You are on spyder6, maybe it's not supported anymore |
the ipython console of spyder is a qtconsole, and so to get a closer experience to web-ipython experience some may expect, they would need to use spyder-notebook It's a very complex matter, that is maybe improvable if Spyder moves to Qt6... but at that time it will be even bigger weight (50 Mo ?) The good News for Spyder/Qt community, is that Qt Company is going well. |
Thank you for the detailed answer. I'm using win 10 and I test it on 2 computers. from pylab import * The figure window pops up but there is no plot and the window not responses. when I do the same on the spyder standalone 6.0.5 installer (https://www.spyder-ide.org/) everything works fine. |
smell like this: spyder-ide/spyder#22224 |
well, the story of wron versions didn't end there, see last commet here spyder-ide/spyder#22420 (comment) we are apparently up-to-date, so the suggestion of this last comment (not a package version) looks right.
|
there is a comment earlier in that thread that suggests to do import matplotlib_inline; |
As you error message as apparently transformed a 'png' into a 'p', 'n', 'g' ... I would presume somewhere a 'png' is taken instead of a list like ("png", "jpeg") ... like an error of "default=", when nothing is provided, somewhere in one's code |
soooo, following this advice from spyder-ide/spyder#22420 (comment) shall save your day
to get: |
anyway Spyder team is discouraging you to use pylab...
|
it's really a no brainer solution: default run doesn't fail
|
Spyder-5 was going to held WinPython back on some dependancies, so there was no question to move to Spyder-6 this round. Spyder-6 is a bit founded per some foundations, so anyway, the only way was forward. if the auto-installer of Spyder works, I presume there shall be a fix in an anaconda version of one of the packages involved
|
still not sure of the root cause... it was supposed to be fixed upstream. |
the suggestion works, while no explanation why standalone spyder did fix it |
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'
The text was updated successfully, but these errors were encountered: