microsoft / microsoft/vscode-python-environments
Kernel crashes when using a Pixi environment with Python Environments enabled
@DonJayamanne がすでに取り組んでいます。
2026年8月14日 から。
- 主要言語
- TypeScript
- スター
- 138
- フォーク
- 62
- 平均マージ
- 1日 4時間
- マージ済み PR(30日)
- 35
説明
## Description
I am experiencing a reproducible Jupyter kernel crash in VS Code when using a Python environment managed by Pixi on Windows.
The exact same Pixi environment and the exact same Matplotlib code work correctly when:
1. Running Python directly through Pixi from a terminal.
2. Running Jupyter Notebook from the Pixi environment in a web browser.
3. Using the same Pixi interpreter as a VS Code Jupyter kernel with the `Python Environments` extension disabled.
The crash occurs when `Python Environments` is enabled.
Disabling `ms-python.vscode-python-envs` also disables `Pixi Code`, since Pixi Code depends on Python Environments. After both extensions are disabled, I can manually select the Pixi `python.exe` as the interpreter and Jupyter kernel, and the exact same code runs correctly.
This makes me suspect an interaction between `ms-python.vscode-python-envs`, the Python extension, Jupyter, and Pixi environment activation.
## Environment
### Operating system
Windows 11, x64.
### VS Code
- Version: 1.133.0 (User Setup)
- Commit: a5b500951314efd502d07465bd138dfbd714a960
- Date: 2026-08-11T22:14:08Z
- Electron: 42.8.0
- Chromium: 148.0.7778.280
- Node.js: 24.18.0
- V8: 14.8.178.38-electron.0
### Pixi
- Pixi version: 0.67.0
- Platform: win-64
- Channel: conda-forge
- Environment: `default`
The environment is located at:
`C:\BackUp\Project\11. Cruces de Emas\proyecto_11\.pixi\envs\default`
### Python
- Python: 3.12.13
### Python packages
- numpy: 2.2.6
- pandas: 2.2.3
- matplotlib: 3.9.4
- ipykernel: 6.31.0
### Relevant VS Code extensions
- Python: `ms-python.python@2026.4.0`
- Python Environments: `ms-python.vscode-python-envs@1.36.0`
- Jupyter: `ms-toolsai.jupyter@2025.9.1`
- Jupyter Notebook Renderers: `ms-toolsai.jupyter-renderers@1.3.0`
- Pixi Code: `renan-r-santos.pixi-code@0.2.0`
- Pylance: `ms-python.vscode-pylance@2026.3.1`
- Python Debugger: `ms-python.debugpy@2026.6.0`
## Minimal reproduction
The following code is sufficient to reproduce the kernel crash:
```python
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(10)
y = x**2
fig, ax = plt.subplots()
ax.scatter(x, y)
plt.show()
````
The problem also occurs when using a Python file with VS Code's `# %%` interactive cells.
## Steps to reproduce
1. Create/open a Pixi project on Windows.
2. Install Python, NumPy, Matplotlib and IPython kernel.
3. Open the project in VS Code.
4. Enable `Python Environments`.
5. Select the Pixi interpreter:
`C:\BackUp\Project\11. Cruces de Emas\proyecto_11\.pixi\envs\default\python.exe`
6. Select the same interpreter as the Jupyter kernel.
7. Run the minimal example above.
8. The kernel crashes.
## Actual behavior
The following logs were captured from the same reproduction.
### Jupyter output
```text
14:29:11.771 [info] Starting interactive window for resource 'c:\BackUp\Project\11. Cruces de Emas\proyecto_11\Vamos a ver.py' with controller '.jvsc74a57bd0d61f5b99e904adbc10bd8d84ee2f59ba23b03f67c32ecc2c7ac4a21ea9a28656.c:\BackUp\Project\11. Cruces de Emas\proyecto_11\.pixi\envs\default\python.exe.c:\BackUp\Project\11. Cruces de Emas\proyecto_11\.pixi\envs\default\python.exe.-m#ipykernel_launcher (Interactive)'
14:29:11.977 [info] Starting Kernel (Python Path: c:\BackUp\Project\11. Cruces de Emas\proyecto_11\.pixi\envs\default\python.exe, Unknown, 3.12.13) for 'Interactive-1.interactive' (disableUI=false)
14:29:41.907 [warn] Failed to get activated env vars for c:\BackUp\Project\11. Cruces de Emas\proyecto_11\.pixi\envs\default\python.exe in 30026ms
14:29:41.913 [info] Process Execution: c:\BackUp\Project\11. Cruces de Emas\proyecto_11\.pixi\envs\default\python.exe -m pip list
14:29:41.995 [info] Process Execution: c:\BackUp\Project\11\ Cruces de Emas\proyecto_11\.pixi\envs\default\python.exe -c "import pip;print('6af208d0-cb9c-427f-b937-ff563e17efdf')"
14:29:42.055 [warn] Failed to get activated env vars for c:\BackUp\Project\11. Cruces de Emas\proyecto_11\.pixi\envs\default\python.exe in 30067ms
14:29:42.060 [info] Process Execution: c:\BackUp\Project\11. Cruces de Emas\proyecto_11\.pixi\envs\default\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
14:29:42.095 [info] Process Execution: c:\BackUp\Project\11. Cruces de Emas\proyecto_11\.pixi\envs\default\python.exe -m ipykernel_launcher --f=~\AppData\Roaming\jupyter\runtime\kernel-v38c41a242ed3053ecd7f0ad2212f3dcc6ceb92f96.json
> cwd: c:\BackUp\Project\11. Cruces de Emas\proyecto_11
14:29:43.630 [info] Kernel successfully started
14:29:43.701 [info] Generated code for 1 = with 12 lines
14:29:44.441 [error] Disposing session as kernel process died ExitCode: 3228369023, Reason:
14:29:44.457 [error] Widget Error: Failed to access CDN https://unpkg.com/ after 0 attempt(s), TypeError: Failed to fetch
```
### Python output
The Python extension attempts to obtain the activated environment variables by executing `pixi shell` twice:
```text
2026-08-14 14:29:11.897 [info] > ~\AppData\Local\pixi\bin\pixi.EXE shell --manifest-path "C:\BackUp\Project\11. Cruces de Emas\proyecto_11\pixi.toml" && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2026.4.0-win32-x64/python_files/printEnvVariables.py
2026-08-14 14:29:11.897 [info] shell: commandPrompt
2026-08-14 14:29:11.993 [info] > ~\AppData\Local\pixi\bin\pixi.EXE shell --manifest-path "C:\BackUp\Project\11. Cruces de Emas\proyecto_11\pixi.toml" && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2026.4.0-win32-x64/python_files/printEnvVariables.py
2026-08-14 14:29:11.993 [info] shell: commandPrompt
2026-08-14 14:29:41.906 [error] getActivatedEnvironmentVariables [Error: Command failed: C:\Users\franc\AppData\Local\pixi\bin\pixi.EXE shell --manifest-path "C:\BackUp\Project\11. Cruces de Emas\proyecto_11\pixi.toml" && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/franc/.vscode/extensions/ms-python.python-2026.4.0-win32-x64/python_files/printEnvVariables.py
at genericNodeError (node:internal/errors:985:15)
at wrappedFn (node:internal/errors:539:14)
at ChildProcess.exithandler (node:child_process:418:12)
at ChildProcess.emit (node:events:521:24)
at maybeClose (node:internal/child_process:1124:16)
at ChildProcess._handle.onexit (node:internal/child_process:1124:16)] {
code: null,
killed: true,
signal: 'SIGTERM',
cmd: `C:\\Users\\franc\\AppData\\Local\\pixi\\bin\\pixi.EXE shell --manifest-path "C:\\BackUp\\Project\\11. Cruces de Emas\\proyecto_11\\pixi.toml" && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/franc/.vscode/extensions/ms-python.python-2026.4.0-win32-x64/python_files/printEnvVariables.py`
}
2026-08-14 14:29:42.054 [error] getActivatedEnvironmentVariables [Error: Command failed: C:\Users\franc\AppData\Local\pixi\bin\pixi.EXE shell --manifest-path "C:\BackUp\Project\11. Cruces de Emas\proyecto_11\pixi.toml" && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/franc/.vscode/extensions/ms-python.python-2026.4.0-win32-x64/python_files/printEnvVariables.py
at genericNodeError (node:internal/errors:985:15)
at wrappedFn (node:internal/errors:539:24)
at ChildProcess.exithandler (node:internal/child_process:418:12)
at ChildProcess.emit (node:events:521:16)
at maybeClose (node:internal/child_process:1124:16)] {
code: null,
killed: true,
signal: 'SIGTERM',
cmd: `C:\\Users\\franc\\AppData\\Local\\pixi\\bin\\pixi.EXE shell --manifest-path "C:\\BackUp\\Project\\11. Cruces de Emas\\proyecto_11\\pixi.toml" && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/franc/.vscode/extensions/ms-python.python-2026.4.0-win32-x64/python_files/printEnvVariables.py`
}
```
The `pixi shell` command is therefore terminated with `SIGTERM` after approximately 30 seconds on both attempts.
### Python Environments output
```text
2026-08-14 14:29:12.166 [info] [SYS_GET] uri=\Interactive-1.interactive, normalizedKey=/interactive-1.interactive, project=none, projectKey=none, mapKeys=[c:/backup/project/11. cruces de emas], directHit=false, projectHit=false, fallbackToGlobal=true, globalEnv=none
2026-08-14 14:30:20.036 [info] [SYS_GET] uri=c:\BackUp\Project\11. Cruces de Emas\proyecto_11\Vamos a ver.py, normalizedKey=c:/backup/project/11. cruces de emas/proyecto_11/vamos a ver.py, project=c:\BackUp\Project\11. Cruces de Emas, projectKey=c:/backup/project/11. cruces de emas, mapKeys=[c:/backup/project/11. cruces de emas], directHit=false, projectHit=true, fallbackToGlobal=false, globalEnv=none
2026-08-14 14:30:31.797 [info] [SYS_GET] uri=c:\BackUp\Project\11. Cruces de Emas\proyecto_11\Vamos a ver.py, normalizedKey=c:/backup/project/11. cruces de emas/proyecto_11/vamos a ver.py, project=c:\BackUp\Project\11. Cruces de Emas, projectKey=c:/backup/project/11. cruces de emas, mapKeys=[c:/backup/project/11. cruces de emas], directHit=false, projectHit=true, fallbackToGlobal=false, globalEnv=none
```
## Important timing observation
The logs from the same execution show the following sequence:
1. VS Code starts the interactive window at `14:29:11`.
2. The Python extension invokes `pixi shell`.
3. The first `pixi shell` attempt is terminated with `SIGTERM` after approximately 30 seconds.
4. Jupyter reports `Failed to get activated env vars`.
5. A second `pixi shell` attempt is made.
6. The second attempt is also terminated with `SIGTERM`.
7. Jupyter starts the kernel successfully at `14:29:43`.
8. The cell executes at `14:29:43`.
9. Approximately 0.7 seconds later, the kernel dies with `ExitCode: 3228369023`.
10. Jupyter then reports a failure to access `https://unpkg.com/`.
## Control tests
I performed several tests to determine whether the problem was caused by Python, Pixi, Jupyter, Matplotlib, or the amount of data.
### 1. Pixi + Python + Matplotlib outside VS Code
The following command works correctly:
```cmd
pixi run python -c "import matplotlib.pyplot as plt; import numpy as np; x=np.arange(10); y=x**2; fig,ax=plt.subplots(); ax.scatter(x,y); plt.show(); print('OK')"
```
The plot is displayed and the Python process does not crash.
### 2. Pixi + Jupyter Notebook outside VS Code
I installed Jupyter Notebook in the same Pixi environment and launched it with:
```cmd
pixi run jupyter notebook
```
The same quadratic scatter plot works correctly in the browser-based Jupyter Notebook interface.
### 3. VS Code + Python Environments enabled
The exact same code crashes the Jupyter kernel.
### 4. VS Code + Python Environments disabled
I disabled:
`ms-python.vscode-python-envs`
This also disables:
`renan-r-santos.pixi-code`
because Pixi Code depends on Python Environments.
I then manually selected the exact same Pixi interpreter:
`C:\BackUp\Project\11. Cruces de Emas\proyecto_11\.pixi\envs\default\python.exe`
and selected it as the Jupyter kernel.
The exact same code then works correctly in VS Code.
This is currently a reliable workaround.
## Version testing
I initially suspected Python 3.14 or recent package versions.
The environment was therefore changed from Python 3.14 to Python 3.12 and the packages were also changed to more conservative versions.
The issue still reproduces with:
* Python 3.12.13
* NumPy 2.2.6
* Pandas 2.2.3
* Matplotlib 3.9.4
* IPython kernel 6.31.0
Therefore, the problem does not appear to be specific to Python 3.14 or the latest NumPy/Matplotlib versions.
The issue also reproduces with only 10 points in a minimal scatter plot, so it is not related to the amount of data.
## Additional observation
Jupyter reports the following immediately after the cell is executed and just after the kernel dies:
```text
Widget Error: Failed to access CDN https://unpkg.com/ after 0 attempt(s), TypeError: Failed to fetch
```
I do not know whether this is related to the kernel crash, so I am including it as additional diagnostic information.
## Related issues
This appears related to:
* microsoft/vscode-jupyter#17142 — "Kernel crashes when trying to plot matplotlib figure"
[https://github.com/microsoft/vscode-jupyter/issues/17142](https://github.com/microsoft/vscode-jupyter/issues/17142)
This issue also reports Windows + Pixi + Jupyter and `ExitCode: 3228369023`, together with `Failed to get activated env vars`.
* microsoft/vscode-python-environments#1407 — "Jupyter kernel startup delayed 30s when extension is installed (pixi environment)"
[https://github.com/microsoft/vscode-python-environments/issues/1407](https://github.com/microsoft/vscode-python-environments/issues/1407)
This issue reports a Pixi + Jupyter problem associated with `ms-python.vscode-python-envs`, including `Failed to get activated env vars`.
My case appears to be more severe: the environment activation attempts take approximately 30 seconds, are terminated with `SIGTERM`, and the Jupyter kernel subsequently dies with `ExitCode: 3228369023`.
## Workaround
The current workaround is:
1. Disable `ms-python.vscode-python-envs`.
2. This also disables `renan-r-santos.pixi-code`.
3. Manually select the Pixi `python.exe`.
4. Select the same interpreter as the Jupyter kernel.
After doing this, the same Jupyter code works correctly in VS Code.
## Request
Could you investigate the interaction between `ms-python.vscode-python-envs`, the Python extension, Jupyter, and Pixi environments on Windows?
In particular, the following sequence seems suspicious:
1. The Python extension invokes `pixi shell --manifest-path ...`.
2. The command does not complete within approximately 30 seconds.
3. The process is terminated with `SIGTERM`.
4. The Python extension retries the same operation.
5. The second attempt is also terminated with `SIGTERM`.
6. Jupyter subsequently starts the kernel successfully.
7. The kernel dies shortly after executing the cell with `ExitCode: 3228369023`.
Could you also clarify whether the `Widget Error: Failed to access CDN https://unpkg.com/` message could be related to the kernel termination?
---
This issue report was written entirely with the assistance of OpenAI's GPT-5.6 Luna. The technical observations, tests, logs, versions, and reproduction steps are my own.
````
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。