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
Problem Description:
When attempting to execute Python code in the terminal by pressing Shift + Enter in Visual Studio Code, an error occurs. This issue specifically arises only when a Conda environment is selected as the Python interpreter. The functionality works correctly when the system Python (/bin/python3) is in use.
Crucial Observation (Key Diagnostic Information):
When it works (no explicit interpreter selected):
If no Python interpreter is explicitly selected in VS Code (meaning /bin/python3 is used as the default), pressing Shift + Enter executes Python code in the terminal without issues.
Python info in this working state: Python 3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0], sys.executable: /bin/python3
When it fails (Conda interpreter selected):
When a Conda environment (e.g., cell_phone or stable_py312, Python 3.12.9) is explicitly selected as the Python interpreter in VS Code, pressing Shift + Enter results in an error.
The error manifests in two forms, sometimes alternating or appearing in sequence when changing folders:
Error: Invalid arguments to create terminal (Occurs during the terminal creation phase)
Error: spawn /home/smart-mobility-dori/miniconda3 EACCES (Occurs when attempting to execute from the Miniconda installation directory, indicating a permission issue)
Steps to Reproduce:
Launch VS Code.
Select a Conda environment (e.g., Conda: stable_py312, Python 3.12.9) as the Python interpreter.
Open or create a .py file and write a simple Python code (e.g., print("Hello!")).
Place the cursor on the line or select the code.
Press Shift + Enter.
Observe either Error: Invalid arguments to create terminal or Error: spawn /home/smart-mobility-dori/miniconda3 EACCES in the Output panel.
Expected Behavior:
When Shift + Enter is pressed, the Python code should execute successfully in the terminal with the selected Conda environment activated.
Actual Behavior and Error Logs:
Log example for Invalid arguments to create terminal:
2025-08-11 19:20:27.290 [error] Error: Invalid arguments to create terminal
at t.ensureTerminalLegacy (/home/smart-mobility-dori/.vscode/extensions/ms-python.python-2025.12.0-linux-x64/out/client/extension.js:2:459220)
at runNextTicks (node:internal/process/task_queues:65:5)
at listOnTimeout (node:internal/timers:549:9)
at process.processTimers (node:internal/timers:523:7)
at async S.ensureTerminal (/home/smart-mobility-dori/.vscode/extensions/ms-python.python-2025.12.0-linux-x64/out/client/extension.js:2:316826)
at async S.show (/home/smart-mobility-dori/.vscode/extensions/ms-python.python-2025.12.0-linux-x64/out/client/extension.js:2:316611)
at async E.initializeRepl (/home/smart-mobility-dori/.vscode/extensions/ms-python.python-2025.12.0-linux-x64/out/client/extension.js:2:890477)
at async E.execute (/home/smart-mobility-dori/.vscode/extensions/ms-python.python-2025.12.0-linux-x64/out/client/extension.js:2:889986)
at async _.executeSelection (/home/smart-mobility-dori/.vscode/extensions/ms-python.python-2025.12.0-linux-x64/out/client/extension.js:2:875193)
at async _.executeSelectionInTerminal (/home/smart-mobility-dori/.vscode/extensions/ms-python.python-2025.12.0-linux-x64/out/client/extension.js:2:874655)
at async /home/smart-mobility-dori/.vscode/extensions/ms-python.python-2025.12.0-linux-x64/out/client/extension.js:2:872727
at async Ab.h (file:///usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:41564) python.execSelectionInTerminal {"value":"ms-python.python","_lower":"ms-python.python"}
Log example for Error: spawn /home/smart-mobility-dori/miniconda3 EACCES:
2025-08-11 17:22:00.370 [error] Error: spawn /home/smart-mobility-dori/miniconda3 EACCES
at ChildProcess._handle.onexit (node:internal/child_process:285:19)
at onErrorNT (node:internal/child_process:483:16)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
(Include any other relevant SIGPIPE or fileWatcher crashed logs if they reappear.)
System Information:
OS: Ubuntu 24.04 LTS (Please provide your exact lsb_release -a output)
VS Code Version: [Your precise code --version output] (e.g., 1.102.x or 1.103.x, if you remember the previous one)
Python Extension Version: ms-python.python-2025.12.0
Conda Version: [Your precise conda --version output]
Python Version in Conda Env (problematic): 3.12.9
Python Version (system, working): 3.12.3 (/bin/python3)
Shell: [Your echo $SHELL output] (e.g., /bin/bash or /usr/bin/zsh)
Hardware: Desktop PC, [Your CPU model, RAM amount, GPU if relevant] (e.g., Intel Core i7-XXXX, 32GB RAM, NVIDIA RTX 3070)
Troubleshooting Performed:
Initial issue: Shift + Enter not working, sometimes EACCES, sometimes SIGPIPE.
Identified and changed problematic Python 3.13 pre-release in Conda env to stable Python 3.12.9.
Reviewed and simplified settings.json and keybindings.json (specifically python.execSelectionInTerminal).
Performed multiple complete uninstalls and reinstalls of Miniconda: This included thorough removal of all Conda directories, cache (~/.conda), .condarc, and all PATH entries/conda initialize blocks from shell config files (.bashrc, .zshrc). Reinstalled using conda init yes.
Performed multiple complete uninstalls and reinstalls of VS Code: This included removing ~/.config/Code, ~/.vscode, and purging the VS Code program package (both APT and Snap methods attempted). Reinstalled using .deb package.
Performed system reboots multiple times between uninstalls/reinstalls.
Verified environment cleanliness (conda --version, echo $PATH, code --version showing "not found") before each reinstall.
Checked AppArmor status (sudo aa-status); vscode profile was in unconfined mode, indicating AppArmor was not blocking.
Jupyter (if installed) worked fine with Conda environments. (My current setup does not have Jupyter installed explicitly, confirming it's not a Jupyter-specific problem).
Crucial Diagnostic: On a different laptop with the exact same Ubuntu 24.04 OS, Shift + Enter works perfectly fine with Conda environments in VS Code. This indicates the issue is specific to this desktop machine.
Crucial Diagnostic: Created a new Ubuntu user account on this problematic desktop and performed a fresh, minimal install of Miniconda and VS Code (Python extension only). The Shift + Enter issue persisted in the new user account, ruling out user profile corruption as the sole cause.
A Vim plugin installation temporarily triggered the issue again, but removing it did not resolve the underlying problem, suggesting it was a trigger rather than the root cause.
Tried specific older VS Code versions (e.g., 1.102.x) but the issue persists.
'Run Python File in Terminal' button (top-right play icon) works correctly.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Problem Description:
When attempting to execute Python code in the terminal by pressing Shift + Enter in Visual Studio Code, an error occurs. This issue specifically arises only when a Conda environment is selected as the Python interpreter. The functionality works correctly when the system Python (/bin/python3) is in use.
Crucial Observation (Key Diagnostic Information):
Steps to Reproduce:
Expected Behavior:
When Shift + Enter is pressed, the Python code should execute successfully in the terminal with the selected Conda environment activated.
Actual Behavior and Error Logs:
System Information:
Troubleshooting Performed:
Beta Was this translation helpful? Give feedback.
All reactions