vscode-python: Venv is not activated on already opened terminal on start up when `python.terminal.activateEnvInCurrentTerminal` is `true`
Issue Type: Bug
Below is my settings.json
:
{
"terminal.integrated.shellArgs.windows": [
"-NoLogo"
],
"workbench.startupEditor": "none",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"code-runner.runInTerminal": true,
"code-runner.saveFileBeforeRun": true,
"workbench.panel.defaultLocation": "right",
"terminal.integrated.copyOnSelection": true,
"python.languageServer": "Pylance",
"python.pythonPath": "C:/Users/AmericaN/Desktop/Lab/MyEnv/Scripts/python.exe",
"code-runner.executorMap": {
"python": "$pythonPath -u $fullFileName"
},
"code-runner.ignoreSelection": true,
"remote.SSH.remotePlatform": {
"My": "linux"
},
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"python.autoComplete.addBrackets": true,
"python.terminal.activateEnvInCurrentTerminal": true,
"files.exclude": {
"**/.vscode": true,
"**/MyEnv": true
},
"code-runner.showExecutionMessage": false,
"python.analysis.completeFunctionParens": true,
"workbench.editorAssociations": [
{
"viewType": "jupyter.notebook.ipynb",
"filenamePattern": "*.ipynb"
}
],
"python.showStartPage": false
}
- open any
.py
file and leave the intergrated termianl open. - close and reopen vscode.
- you will find that the enviroment is not activated.
But if i closed the terminal and reopened it again, so the enviroment will be activated.
And here’s the log from Python log:
User belongs to experiment group 'pythonaa'
User belongs to experiment group 'pythonSendEntireLineToREPL'
User belongs to experiment group 'pythonNotDisplayLinterPrompt'
User belongs to experiment group 'pythonDiscoveryModulecf'
User belongs to experiment group 'pythonTensorboardExperimentcf'
User belongs to experiment group 'PythonPyTorchProfiler'
User belongs to experiment group 'ShowExtensionSurveyPrompt - enabled'
User belongs to experiment group 'CollectLSRequestTiming - control'
> conda --version
> pyenv root
> python3.7 c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -3.7 c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -3.6 c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -3 c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -2 c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> c:\Users\AmericaN\Desktop\Lab\MyEnv\Scripts\python.exe c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> conda info --json
Python interpreter path: .\MyEnv\Scripts\python.exe
Starting Pylance language server.
Error 2021-03-28 05:27:16: Detection of Python Interpreter for Command py and args -3.6 failed as file Python 3.6 not found!
-3.9-64 does not exist
Error 2021-03-28 05:27:16: Detection of Python Interpreter for Command py and args -3.7 failed as file Python 3.7 not found!
-3.9-64 does not exist
Error 2021-03-28 05:27:16: Detection of Python Interpreter for Command python3 and args failed as file does not exist
Error 2021-03-28 05:27:16: Detection of Python Interpreter for Command py and args -2 failed as file Python 2 not found!
-3.9-64 does not exist
Error 2021-03-28 05:27:16: Failed to get interpreter information for 'C:\Users\AmericaN\AppData\Local\Microsoft\WindowsApps\python.exe' [Error: Command failed: "C:\\Users\AmericaN\AppData\Local\Microsoft\WindowsApps\python.exe" "c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py" "c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\interpreterInfo.py"
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
at ChildProcess.exithandler (child_process.js:312:12)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:443:11)
at Socket.emit (events.js:315:20)
at Pipe.<anonymous> (net.js:674:12)] {
killed: false,
code: 9009,
signal: null,
cmd: '"C:\\\\Users\\AmericaN\\AppData\\Local\\Microsoft\\WindowsApps\\python.exe" "c:\\Users\\AmericaN\\.vscode\\extensions\\ms-python.python-2021.3.680753044\\pythonFiles\\pyvsc-run-isolated.py" "c:\\Users\\AmericaN\\.vscode\\extensions\\ms-python.python-2021.3.680753044\\pythonFiles\\interpreterInfo.py"'
}
Error 2021-03-28 05:27:16: Failed to get interpreter information for 'C:\Users\AmericaN\AppData\Local\Microsoft\WindowsApps\python3.exe' [Error: Command failed: "C:\\Users\AmericaN\AppData\Local\Microsoft\WindowsApps\python3.exe" "c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py" "c:\Users\AmericaN\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\interpreterInfo.py"
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
at ChildProcess.exithandler (child_process.js:312:12)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:443:11)
at Socket.emit (events.js:315:20)
at Pipe.<anonymous> (net.js:674:12)] {
killed: false,
code: 9009,
signal: null,
cmd: '"C:\\\\Users\\AmericaN\\AppData\\Local\\Microsoft\\WindowsApps\\python3.exe" "c:\\Users\\AmericaN\\.vscode\\extensions\\ms-python.python-2021.3.680753044\\pythonFiles\\pyvsc-run-isolated.py" "c:\\Users\\AmericaN\\.vscode\\extensions\\ms-python.python-2021.3.680753044\\pythonFiles\\interpreterInfo.py"'
}
> conda --version
Extension version: 2021.3.680753044 VS Code version: Code 1.54.3 (2b9aebd5354a3629c3aba0a5f5df49f43d6689f8, 2021-03-15T10:55:45.459Z) OS version: Windows_NT x64 10.0.19042
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i7-7700HQ CPU @ 2.80GHz (8 x 2808) |
GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on protected_video_decode: enabled rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | undefined |
Memory (System) | 15.86GB (7.83GB free) |
Process Argv | –crash-reporter-id b6c0830d-6a13-4115-8888-7dc0b49df85d |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
pythonvspyt700cf:30270857
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstry244:30276681
pythonvsdeb440:30248342
pythonvsded773:30248341
pythonvspyt875:30259475
pythonvsnew554cf:30280384
pythontbcf:30265426
vspre833:30267464
pythonptprofiler:30281270
vshan820cf:30276953
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 60
Yes, although on Mac OS X, one would have to actually quit the program since Mac OS X leaves programs open by default. Anyways, just food for thought if you notice something funny in the future.
Yes, actually the setting is only available in User scope. You can use
Open User settings
command from the command palette and set it there. Appreciate the effort!@JackLilhammers Can you please fill the issue template which has the logs, and try https://github.com/microsoft/vscode-python/issues/15798#issuecomment-847462574 and see if helps? Set
python.logging.level
toinfo
in user settings and then reload. Then check the logs as follows,Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
; turn on source maps to make any tracebacks be useful by runningEnable source map support for extension debugging
)I have the exact same issue. To activate
venv
in Powershell terminal, I still have to open a new shell (what I’ve had to do in the past).