Skip to content

Plots not displaying (matplotlib with TkAgg) #16721

Closed

Description

Issue Type: Bug

Plot is not getting displayed in vscode

To reprouce
import matplotlib
matplotlib.use('TkAgg') # not working even with default 'agg'
from matplotlib import pyplot as plt
plt.figure()
#plt.bar(foo,bar)
plt.show()

VS Code version: Code 1.58.1 (2aeda6b18e13c4f4f9edf6667158a6b8d408874b, 2021-07-13T06:58:28.115Z)
OS version: Windows_NT x64 10.0.22000
Restricted Mode: No
Remote OS version: Linux x64 5.4.0-1051-azure

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz (8 x 2112)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.75GB (1.99GB free)
Process Argv --open-url --crash-reporter-id bb5a6bf5-d714-48a5-9eba-811de0544190 -- vscode://ms-toolsai.vscode-ai/computeInstance/remote?computeId=/subscriptions/da9091ec-d18f-456c-9c21-5783ee7f4645/resourceGroups/bkuriachan-rg/providers/Microsoft.MachineLearningServices/workspaces/crop-classification-aml/computes/crop-classification-cpu&sessionId=EchP7
Screen Reader no
VM 0%
Item Value
Remote Azure ML: crop-classification-cpu
OS Linux x64 5.4.0-1051-azure
CPUs Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz (4 x 2593)
Memory (System) 27.43GB (21.37GB free)
VM 0%
Extensions (11)
Extension Author (truncated) Version
vscode-ai-remote ms- 0.4.0
remote-containers ms- 0.187.0
remote-wsl ms- 0.58.2
notepadplusplus-keybindings ms- 1.0.7
vscode-icons vsc 11.5.0
python ms- 2021.6.944021595
vscode-pylance ms- 2021.7.3
jupyter ms- 2021.8.1013163132
vscode-ai ms- 0.6.24
vscode-ai-remote ms- 0.4.0
azure-account ms- 0.9.8
A/B Experiments
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
vspor879:30202332
vspor708:30202333
vspor363:30204092
vspre833:30321513
vshan820:30294714
vscus158:30321503
vscod805cf:30301675
bridge0708:30335490

Activity

  1. bkuriach commented on Jul 15, 2021

    @bkuriach
    Author

    Using VSCode from AML

  2. kieferrm commented on Jul 17, 2021

    @kieferrm
    Member

    This is code in a normal python file, a notebook? Pls give us the steps to reproduce the problem.

  3. kieferrm commented on Jul 17, 2021

    @kieferrm
    Member

    /needsMoreInfo

  4. vscode-triage-bot commented on Jul 17, 2021

    @vscode-triage-bot

    Thanks for creating this issue! We figured it's missing some basic information or in some other way doesn't follow our issue reporting guidelines. Please take the time to review these and update the issue.

    Happy Coding!

  5. bkuriach commented on Jul 19, 2021

    @bkuriach
    Author

    This is normal python. Plots are working fine in notebooks.

    To reproduce
    import matplotlib
    matplotlib.use('TkAgg') # not working even with default 'agg'
    from matplotlib import pyplot as plt
    plt.figure()
    #plt.bar(foo,bar)
    plt.show()

  6. karthiknadig commented on Jul 19, 2021

    @karthiknadig
    Member

    Binil Kuriachan (@bkuriach) Is this when debugging?

  7. added
    info-neededIssue requires more information from poster
    bugIssue identified by VS Code Team member as probable bug
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Jul 19, 2021
  8. bkuriach commented on Jul 19, 2021

    @bkuriach
    Author

    No, in normal execution (executed as block using shift+enter).
    Like I said before, I am Using VSCode from AML.

  9. karthiknadig commented on Jul 19, 2021

    @karthiknadig
    Member

    Binil Kuriachan (@bkuriach) I asked about debugging because we recently addressed an issue with debugging and plotting. Can you describe when you mean by running. Are you executing the script manually by typing python <script-path> in VS Code terminal? or are you running using a UI? If you are using the UI, are you using a virtual environment?

  10. karthiknadig commented on Jul 19, 2021

    @karthiknadig
    Member

    Do you get a different result running this from VS Code terminal and terminal outside of VS Code?

  11. MangoSister commented on Jul 23, 2021

    @MangoSister

    Karthik Nadig (@karthiknadig) Sorry for hijacking the thread, but I seem to experience what you described: When I debug a script inside VSCode (UI: run->start debugging, or press F5), it seems to force the pyplot interactive mode to be on with the log "Backend Qt5Agg is interactive backend. Turning interactive mode on." Then plt.show() instantly returns. If I run the same script outside VSCode then it works fine. I am using a conda environment. My python extension version is v2021.7.1060902895, and VSCode version 1.58.2. Has this already been fixed?

  12. karthiknadig commented on Jul 24, 2021

    @karthiknadig
    Member

    MangoSister Do you see a difference if you run with Ctrl+F5 (i.e, Run without debugging)?

  13. MangoSister commented on Jul 24, 2021

    @MangoSister

    Karthik Nadig (@karthiknadig) Ctrl+F5 works fine. Also, not sure but I think even when running with F5, the problem only happens if you actually set a breakpoint.

  14. bkuriach commented on Aug 7, 2021

    @bkuriach
    Author

    To reproduce the issue, please execute below code in block (Shift+Enter), I don't see the plot. (VSCODE from Azure Machine Learning)

    image

    image

  15. bkuriach commented on Oct 7, 2021

    @bkuriach
    Author

    Karthik Nadig (@karthiknadig): Still facing the issue.. Please let me know if you need any more details. I have provided steps to reproduce the issue (make sure you are using AML remote extension and it is connected to AML Compute). Its not in debug mode

  16. karthiknadig commented on Dec 2, 2021

    @karthiknadig
    Member

    This is a duplicate of microsoft/vscode-tools-for-ai#1297

  17. locked as resolved and limited conversation to collaborators on Jan 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-debuggingbugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions