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
Importing third party packages crashes kernel of Jupyter notebooks in VScode #25700
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): mamba
Jupyter server running: Local
Expected behaviour
Until this morning, I could use my Python environments and create new ones with e.g. mamba create -n <name> -c conda-forge python=3.12 numpy jupyter ... which would work in VScode and I could import any installed package.
Actual behaviour
Now, whenever I try to import a third party package, the kernel dies (even for freshly installed environments) and the logs show the following errors:
[error] Failed to get activated conda env vars for c:\Trusted\test_env2\python.exe [error] Unable to determine site packages path for python c:\Trusted\test_env2\python.exe (Conda)
The kernel nevertheless starts successfully and can import packages like os and generally execute cells. Only third party packages cause the kernel crash. When instead activating an environment in the command line and starting jupyter from there, everything works normally. Also, my old environments still work as intended, as well, even in VScode.
Noteworthy, the Python environments are stored in this Trusted folder while mamba is installed under C:\Program Files\miniforge3\Scripts\mamba.exe as per company policy. However, until now this setup worked.
Steps to reproduce:
If the installation paths are the culprit, I am not sure how this would be easily reproducible elsewhere.
Exact same issue with a fresh Windows 11 and VS Code install, etc.
The output is identical indicating the same ExitCode 3228369023 and no "Reason" provided.
11:58:16.131 [info] Restarted d5c4b729-17e8-4919-8ac0-68d4f6ce362c
11:58:28.033 [info] Generated code for 11 = <ipython-input-11-2bcfa45c40a8> with 8 lines
11:58:36.223 [info] Generated code for 12 = <ipython-input-12-a0d2faabd9e9> with 1 lines
11:58:40.101 [error] Disposing session as kernel process died ExitCode: 3228369023, Reason:
Importantly:
Importing standard Python packages (e.g. os, sys, time, etc.) causes no issue as seen at time stamp 11:58:28:033.
Importing any third-party package (e.g. Numpy, Pandas, Matplotlib, etc.) results in the kernel crash a few seconds later (i.e., time stamp 11:58:36:223).
This is not an issue when running python scripts directly in a terminal/command prompt (i.e., in the same venv/conda env) — it only occurs when attempting to run on VS Code.
My remote Linux Ubuntu 22 workstation, which has not been updated in some time, does not have this issue.
loewenm (@loewenm)
The problem is the conda environment isn't getting activated.
Please can you share the logs from your Python extension as well (please replicate the problem before sharing the logs, to get to the python logs, just open the Python output panel instead of Jupyter)
That sounds right: it is failing to open the correct conda environment when restarting the kernel.
Importantly, I am able to activate this environment in CMD Prompt and run scripts, etc. However, I cannot activate it in PowerShell, which I'm assuming that VS Code is using.
This is a fresh install and new computer. Did I forget to do something during install?
python output only
2025-12-24 09:33:34.639 [info] Using interpreter path: undefined
2025-12-24 09:33:34.640 [info] Using Windows-specific commands: activate, conda activate gics_sectors_v3
2025-12-24 09:33:34.657 [info] > activate && conda activate pytorch_env && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2025.20.1-win32-x64/python_files/printEnvVariables.py
2025-12-24 09:33:34.658 [info] shell: commandPrompt
2025-12-24 09:33:34.709 [error] getActivatedEnvironmentVariables [Error: Command failed: activate && conda activate pytorch_env && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/mloewen/.vscode/extensions/ms-python.python-2025.20.1-win32-x64/python_files/printEnvVariables.py
'activate' is not recognized as an internal or external command,
operable program or batch file.
at genericNodeError (node:internal/errors:983:15)
at wrappedFn (node:internal/errors:537:14)
at ChildProcess.exithandler (node:child_process:418:12)
at ChildProcess.emit (node:events:531:35)
at maybeClose (node:internal/child_process:1101:16)
at Socket.<anonymous> (node:internal/child_process:456:11)
at Socket.emit (node:events:519:28)
at Pipe.<anonymous> (node:net:346:12)] {
code: 1,
killed: false,
signal: null,
cmd: "activate && conda activate pytorch_env && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/mloewen/.vscode/extensions/ms-python.python-2025.20.1-win32-x64/python_files/printEnvVariables.py"
}
Activity
loewenm commentedon Dec 17, 2025
Exact same issue with a fresh Windows 11 and VS Code install, etc.
The output is identical indicating the same ExitCode 3228369023 and no "Reason" provided.
Importantly:
DonJayamanne commentedon Dec 18, 2025
loewenm (@loewenm) are you also using a Conda/Pixi environment?
loewenm commentedon Dec 19, 2025
I am using a recently installed Conda environment on Windows 11. Here's my full build.
DonJayamanne commentedon Dec 19, 2025
loewenm (@loewenm)
Please could you enable logging as follows:
Jupyter->LoggingtraceJupyteroutput panel (use the commandJupyter: Show Outputto get to the logs).loewenm commentedon Dec 23, 2025
Jupter logging output below
Order of events:
from IPython.display import display, works without issueDonJayamanne commentedon Dec 24, 2025
loewenm (@loewenm)
The problem is the conda environment isn't getting activated.
Please can you share the logs from your Python extension as well (please replicate the problem before sharing the logs, to get to the python logs, just open the
Pythonoutput panel instead ofJupyter)loewenm commentedon Dec 24, 2025
That sounds right: it is failing to open the correct conda environment when restarting the kernel.
Importantly, I am able to activate this environment in CMD Prompt and run scripts, etc. However, I cannot activate it in PowerShell, which I'm assuming that VS Code is using.
This is a fresh install and new computer. Did I forget to do something during install?
python output only
loewenm commentedon Dec 24, 2025
Update: I figured it out - This is not a VS Code issue. My apologies.
How to fix: In PowerShell, I needed to change ExecutionPolicy to RemoteSigned
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSignedI'm assuming this is a change with respect to Windows 11 itself as I'm quite sure that I did not perform this action on my previous workstation.
Thank you for your help Don Jayamanne (@DonJayamanne)
eleanorjboyd commentedon Jan 5, 2026
glad to hear you resolved it- happy coding!