You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug Report: Spyder Ipython crashing after mplfinance.plot() #183
Describe the bug
Running mplfinance.plot() in Spyder, if Ipython Console is set with automatic graphic output (Preference->Ipython Console->Graphics->Output: Automatic), Ipython crashes.
Please verify if this bug is related to mplfinance.
To Reproduce
Set Spyder preferente to plot graphic output not inline (Preference->Ipython Console->Graphics->Output: Automatic);
What do you mean by "crashing"? Since you have not posted a Traceback or similar evidence of a crash, I am going to assume you mean that the Ipython console is unresponsive (not necessarily a crash). If you mean something else, please let me know.
Most likely the Ipython console is unresponsive because matplotlib is waiting for input. The default for matplotlib.pyplot.show(), when displaying the plot in a separate window, is to block further running of the plotting script until the user finishes interacting with with the plot window and closes it. If you close the plot window, then your Ipython console should continue running.
You can disengage this default behavior by including kwarg block=False:
mplfinance.plot(data,...,block=False,...)
Please let me know if that helps. All the best. --Daniel
You are right, what I mean is Ipython console gets unresponsive. But this persists even after closing the plot window (Ipython console stucks running). Even the stop button of the console does not work and I need to close the current console and start a new one.
But using the kwarg block=False works! It seems the problem is the close event of the plot window is getting not captured by Ipyhton console. Anyway, using the kwarg doesn't bother me :) Thank you very much for the help.
Cleiton,
Thank you for letting me know. I'm glad block=False is working for you. I have heard this before: With simple ipython, closing the plot window will cause the ipython prompt to come back and everything is fine, but apparently the ipython console in Spyder gets stuck. As you said the close event is somehow not captured.
I've never used Spyder. When I have some extra time I will try and see if I can reproduce the problem. At this point its difficult to say if the issue is the way matplotlib implements the block, or how Spyder responds to it.
I have decided this is indeed a bug. I was under the impression that kwarg block had two possible values, True and False. Apparently it has also a third possible value: None which behaves differently from either True or False.
What None does is behave as if True for regular Python and simple Ipython, but behave as if False for "Ipython with its pylab mode" (which is apparently what Spyder uses).
Therefore I am changing the default value of block to be None. Users can override the default by setting the kwarg to either True or False. I was able to reproduce the issue running Spyder on Ubuntu, and confirmed that changing the default value fixes the issue.
I expect to release this change by the end of this week.
Activity
DanielGoldfarb commentedon Jun 21, 2020
Cleiton,
What do you mean by "crashing"? Since you have not posted a Traceback or similar evidence of a crash, I am going to assume you mean that the Ipython console is unresponsive (not necessarily a crash). If you mean something else, please let me know.
Most likely the Ipython console is unresponsive because matplotlib is waiting for input. The default for
matplotlib.pyplot.show(), when displaying the plot in a separate window, is to block further running of the plotting script until the user finishes interacting with with the plot window and closes it. If you close the plot window, then your Ipython console should continue running.You can disengage this default behavior by including kwarg
block=False:Please let me know if that helps. All the best. --Daniel
cleitonmoya commentedon Jun 21, 2020
Hi Daniel,
You are right, what I mean is Ipython console gets unresponsive. But this persists even after closing the plot window (Ipython console stucks running). Even the stop button of the console does not work and I need to close the current console and start a new one.
But using the kwarg
block=Falseworks! It seems the problem is the close event of the plot window is getting not captured by Ipyhton console. Anyway, using the kwarg doesn't bother me :) Thank you very much for the help.Kind regards,
Cleiton
DanielGoldfarb commentedon Jun 21, 2020
Cleiton,
Thank you for letting me know. I'm glad
block=Falseis working for you. I have heard this before: With simple ipython, closing the plot window will cause the ipython prompt to come back and everything is fine, but apparently the ipython console in Spyder gets stuck. As you said the close event is somehow not captured.I've never used Spyder. When I have some extra time I will try and see if I can reproduce the problem. At this point its difficult to say if the issue is the way matplotlib implements the block, or how Spyder responds to it.
DanielGoldfarb commentedon Jun 22, 2020
I have decided this is indeed a bug. I was under the impression that kwarg
blockhad two possible values,TrueandFalse. Apparently it has also a third possible value:Nonewhich behaves differently from eitherTrueorFalse.What
Nonedoes is behave as ifTruefor regular Python and simple Ipython, but behave as ifFalsefor "Ipython with its pylab mode" (which is apparently what Spyder uses).Therefore I am changing the default value of
blockto beNone. Users can override the default by setting the kwarg to eitherTrueorFalse. I was able to reproduce the issue running Spyder on Ubuntu, and confirmed that changing the default value fixes the issue.I expect to release this change by the end of this week.
DanielGoldfarb commentedon Jun 24, 2020
pip install --upgrade mplfinanceand you won't needblock=Falseanymore.