-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Environment data
- VS Code version: 1.105.0
- Jupyter Extension version (available under the Extensions sidebar): 2025.9.0
- Python Extension version (available under the Extensions sidebar): 2025.16.0
- OS (Windows | Mac | Linux distro) and version: Windows_NT x64 10.0.26120
- Python and/or Anaconda version: 3.14.0
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): NA
- Jupyter server running: Local
Expected behaviour
Expect the matplotlib can show the image and save the image to file.
Actual behaviour
The kernel died.
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
- Run the code.
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [4, 5, 6])
This bug is very close to Issue microsoft/vscode-jupyter#9283. I have been experimenting with it.
I found that this bug seems to be related to the python environments(ms-python.vscode-python-envs) extension. The bug only occurs when the extension is enabled and activated(in the python.useEnvironmentsExtension setting), and when using an interpreter that is not a conda or a venv environment interpreter(such as the pixi environment in this case.).
The bug would also sometimes occur even when using a conda environment interpreter if "python-envs.defaultEnvManager": "ms-python.python:system" is set in the vscode workspace.
I also experiment with other matplotlib backends(agg, qtagg, tkagg and so on) and other python versions(3.12-3.14). These do not affect the outcomes.
However the bug would not happen in the jupyter notebook running in the browser, or using the jupyterhub extension(ms-toolsai.jupyter-hub) in vscode to connect to a running jupyter server.
Logs
Output for Jupyter in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Jupyter)
18:05:32.718 [warn] Failed to get activated env vars for d:\Academic\global_soil_moisture_pattern\sm_pattern_new\.pixi\envs\default\python.exe in 30178ms
18:05:32.782 [info] Process Execution: d:\Academic\global_soil_moisture_pattern\sm_pattern_new\.pixi\envs\default\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
18:05:32.846 [info] Process Execution: d:\Academic\global_soil_moisture_pattern\sm_pattern_new\.pixi\envs\default\python.exe -Xfrozen_modules=off -m ipykernel_launcher --f=~\AppData\Roaming\jupyter\runtime\kernel-v324d4ded8293c9240fc9812540c55c92d907ccd53.json
> cwd: d:\test
18:05:34.131 [info] Restarted cd4f7a9a-e0ff-4c9e-aab2-971daca8e25d
18:05:34.711 [error] Disposing session as kernel process died ExitCode: 3228369023, Reason: traitlets.traitlets.TraitError