forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed as not planned
Labels
experimentingFeature is part of an experimentFeature is part of an experimentinfo-neededIssue requires more information from posterIssue requires more information from postertriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Description
Type: Bug
Behaviour
Expected vs. Actual
The new auto-activation environment scheme is not working here. If I run pip list
, I can't see the packages that are installed in the virtual env. If I manually activate the environment, it works.
Steps to reproduce:
- Open a Python project that has an associated conda virtual env (
myenv
) - Have a
settings.json
like this:
settings.json
{
"terminal.integrated.profiles.windows": {
"My PowerShell": {
"source": "PowerShell",
"args": [
"-NoExit",
"-Command",
"C:\\Users\\[REDACTED]\\proxy.ps1"
]
}
},
"terminal.integrated.defaultProfile.windows": "My PowerShell",
"terminal.integrated.enableMultiLinePasteWarning": false,
"workbench.startupEditor": "newUntitledFile",
"workbench.editorAssociations": {"*.ipynb": "jupyter-notebook"},
"workbench.iconTheme": "vscode-icons",
"editor.minimap.enabled": false,
"editor.rulers": [88],
"explorer.confirmDragAndDrop": false,
"explorer.confirmDelete": false,
"git.enableSmartCommit": true,
"git.confirmSync": false,
"python.terminal.activateEnvInCurrentTerminal": true,
"python.analysis.autoImportCompletions": false,
"isort.args": ["--profile", "black"],
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnType": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"rewrap.autoWrap.enabled": true,
},
"[html]":{
"editor.formatOnSave": true,
},
"jupyter.askForKernelRestart": false,
"jupyter.widgetScriptSources": ["jsdelivr.com", "unpkg.com"],
"git.mergeEditor": true,
"diffEditor.maxComputationTime": 0,
"liveServer.settings.donotVerifyTags": true,
"liveServer.settings.donotShowInfoMsg": true,
"diffEditor.ignoreTrimWhitespace": false,
"http.proxySupport": "on",
"jupyter.allowUnauthorizedRemoteConnection": true,
"security.workspace.trust.untrustedFiles": "open",
"http.proxyAuthorization": null,
"python.defaultInterpreterPath": "C:\\Users\\[REDACTED]\\AppData\\Local\\miniconda3\\envs\\[REDACTED]\\python.exe",
"http.proxy": "[REDACTED]",
"editor.inlineSuggest.enabled": true,
"powershell.promptToUpdatePowerShell": false,
"git.openRepositoryInParentFolders": "never",
"update.enableWindowsBackgroundUpdates": false,
"redhat.telemetry.enabled": false,
"workbench.colorTheme": "One Dark Modern",
}
- A cute message pops up reassuring me that I can safely ignore the
(base)
on the terminal andmyenv
is in fact activated...
- ...except that it's not. If i run
pip list
, I cannot see the packages that are installed in my target virtual env. - I also couldn't import the missing packages from the python interpreter.
- If I manually run
conda activate myenv
, I got the expected(myenv)
prompt and all works fine. - Interestingly, if I debug a python script that imports packages that are only installed in
myenv
while in the(base)
scenario, the script runs (noImportError
).
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.11.7
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
- Value of the
python.languageServer
setting: Default
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
2024-02-06 09:19:06.402 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-02-06 09:19:06.403 [info] Experiment 'pythonREPLSmartSend' is active
2024-02-06 09:19:06.403 [info] Experiment 'pythonSurveyNotification' is active
2024-02-06 09:19:06.403 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-02-06 09:19:06.403 [info] Experiment 'pythonTestAdapter' is active
2024-02-06 09:19:06.403 [info] Default formatter is set to ms-python.black-formatter for workspace c:\Users\[REDACTED]
2024-02-06 09:19:06.403 [info] Test server listening.
2024-02-06 09:19:06.403 [info] Python interpreter path: ~\AppData\Local\miniconda3\envs\myenv\python.exe
2024-02-06 09:19:06.403 [info] Send text to terminal: echo C:\Program Files\PowerShell\7\pwsh.exe
2024-02-06 09:19:07.851 [info] > conda info --json
2024-02-06 09:19:08.427 [warning] Identifier for virt-virtualenv failed to identify d:\Code\[REDACTED]\.env\Scripts\python.exe [Error: ENOENT: no such file or directory, scandir 'd:\Code\[REDACTED]\.env\Scripts'] {
errno: -4058,
code: 'ENOENT',
syscall: 'scandir',
path: 'd:\\Code\\[REDACTED]\\.env\\Scripts'
}
2024-02-06 09:19:08.694 [info] Shell integration is not working for powershellCore
2024-02-06 09:19:08.696 [warning] Shell integration is not active, environment activated maybe overriden by the shell.
2024-02-06 09:19:08.699 [info] > conda info --json
2024-02-06 09:19:08.699 [info] shell: powershellCore
2024-02-06 09:19:09.072 [info] > "d:\Code\[REDACTED]\.env\Scripts\python.exe" -I ~\.vscode\extensions\ms-python.python-2024.0.0\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2024.0.0\pythonFiles\interpreterInfo.py
2024-02-06 09:19:11.377 [info] Starting Pylance language server.
2024-02-06 09:19:15.512 [error] Error: Command failed: "d:\Code\[REDACTED]\.env\Scripts\python.exe" -I c:\Users\[REDACTED]\.vscode\extensions\ms-python.python-2024.0.0\pythonFiles\get_output_via_markers.py c:\Users\[REDACTED]\.vscode\extensions\ms-python.python-2024.0.0\pythonFiles\interpreterInfo.py
'"d:\Code\[REDACTED]\.env\Scripts\python.exe"' n�o � reconhecido como um comando interno
ou externo, um programa oper�vel ou um arquivo em lotes.
at ChildProcess.exithandler (node:child_process:431:12)
at ChildProcess.emit (node:events:526:35)
at maybeClose (node:internal/child_process:1091:16)
at Process.onexit (node:internal/child_process:302:5) {
code: 1,
killed: false,
signal: null,
cmd: '"d:\\Code\\[REDACTED]\\.env\\Scripts\\python.exe" -I c:\\Users\\[REDACTED]\\.vscode\\extensions\\ms-python.python-2024.0.0\\pythonFiles\\get_output_via_markers.py c:\\Users\\[REDACTED]\\.vscode\\extensions\\ms-python.python-2024.0.0\\pythonFiles\\interpreterInfo.py'
}
2024-02-06 09:19:17.527 [info] > "d:\Code\[REDACTED]\.env\Scripts\python.exe" -I ~\.vscode\extensions\ms-python.python-2024.0.0\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2024.0.0\pythonFiles\interpreterInfo.py
2024-02-06 09:19:20.613 [error] Error: Command failed: "d:\Code\[REDACTED]\.env\Scripts\python.exe" -I c:\Users\[REDACTED]\.vscode\extensions\ms-python.python-2024.0.0\pythonFiles\get_output_via_markers.py c:\Users\[REDACTED]\.vscode\extensions\ms-python.python-2024.0.0\pythonFiles\interpreterInfo.py
'"d:\Code\[REDACTED]\.env\Scripts\python.exe"' n�o � reconhecido como um comando interno
ou externo, um programa oper�vel ou um arquivo em lotes.
at ChildProcess.exithandler (node:child_process:431:12)
at ChildProcess.emit (node:events:526:35)
at maybeClose (node:internal/child_process:1091:16)
at Socket.<anonymous> (node:internal/child_process:449:11)
at Socket.emit (node:events:514:28)
at Pipe.<anonymous> (node:net:323:12) {
code: 1,
killed: false,
signal: null,
cmd: '"d:\\Code\\[REDACTED]\\.env\\Scripts\\python.exe" -I c:\\Users\\[REDACTED]\\.vscode\\extensions\\ms-python.python-2024.0.0\\pythonFiles\\get_output_via_markers.py c:\\Users\\[REDACTED]\\.vscode\\extensions\\ms-python.python-2024.0.0\\pythonFiles\\interpreterInfo.py'
}
2024-02-06 09:19:25.912 [info] > conda run -n afpesp --no-capture-output python ~\.vscode\extensions\ms-python.python-2024.0.0\pythonFiles\get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/printEnvVariables.py
2024-02-06 09:19:25.912 [info] shell: commandPrompt
2024-02-06 09:19:28.622 [info] > conda run -n afpesp --no-capture-output python ~\.vscode\extensions\ms-python.python-2024.0.0\pythonFiles\get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/printEnvVariables.py
2024-02-06 09:19:28.622 [info] shell: powershellCore
2024-02-06 09:19:38.755 [info] > python ~/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/printEnvVariables.py
2024-02-06 09:19:38.755 [info] shell: powershellCore
2024-02-06 09:19:40.879 [info] Send text to terminal: & python c:\Users\[REDACTED]\.vscode\extensions\ms-python.python-2024.0.0\pythonFiles\printEnvVariablesToFile.py c:\Users\[REDACTED]\.vscode\extensions\ms-python.python-2024.0.0\pythonFiles\deactivate\powershell\envVars.txt
User Settings
languageServer: "Pylance"
testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true
Extension version: 2024.0.0
VS Code version: Code 1.85.2 (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:10.514Z)
OS version: Windows_NT x64 10.0.19042
Modes:
System Info
Item | Value |
---|---|
CPUs | 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz (8 x 1498) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled |
Load (avg) | undefined |
Memory (System) | 15.40GB (3.94GB free) |
Process Argv | --crash-reporter-id f02ec49e-7219-47e8-8815-4c59941e60c8 |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
vscaat:30438848
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30951796
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
dsvsc019b:30953937
3ef8e399:30949928
benglewis
Metadata
Metadata
Assignees
Labels
experimentingFeature is part of an experimentFeature is part of an experimentinfo-neededIssue requires more information from posterIssue requires more information from postertriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team