Problems with Interactive Plotting in Debug Mode in PyCharm Version 2017.1

Completed

In earlier Versions of PyCharm it was possible to interactively plot a figure with matplotlib in the debug console without blocking the console. Example:

  • plt.imshow(2dgrid) 

directly opened the figure. I could do it several times to look at different results while in debugging mode.

 

Since 2017.1 I have to manually call show() which then blocks the console until the figure is destroyed. Example: 

  • plt.imshow(2dgrid) 
  • plt.show() 

Without plt.show() the figure does not open up. Additionallay plt.show() blocks the console. Trying plt.show(block=False) crashes the figure. Process finished with exit code -805306369 (0xCFFFFFFF)

I hope my problem is comprehensible. Is this a bug under Version  2017.1? 

4
7 comments

I am having the exact same problem.  Makes me regret switching to 2017.1 from 2016.3 because I use plotting in the debugger as my primary tool.

0

There is already a solution for this problem:
https://youtrack.jetbrains.com/issue/PY-23413

In PyCharm go to:

  • Run --> Edit Configurations --> Add Environment Variabes "Display True"

2

works for me now, thanks for pointing to the solution.

0

I am still having troubles with matplotlib, even doing what is recommended here. I need help.

9

You can show the plots in a separate window using the hint from https://youtrack.jetbrains.com/issue/PY-26652:

.... Check you have an option "Show plots in toolwindow" enabled in Settings | Tools | Python Scientific. After that you can run a script which contains pyplot.show() call and your graph will appear in a tool window "SciView". 

0

I am also facing this problem on version  PyCharm 2021.3.1 (Community Edition). And the fix (adding env, DISPLAY = True) does not help.

And it seems below link is also broke.

https://youtrack.jetbrains.com/issue/PY-26652:

Can someone help me on this ?

 

 

 

0

Having this issue with 2024.1 IntelliJ IDEA (Community Edition). 

2

Please sign in to leave a comment.