Repository navigation
TypeError: this.context.getEnvironmentVariableCollection is not a function #21831
Description
Activity
- addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Aug 17, 2023 Two things:
-
Can you please provide the output?
Output for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)XXX -
Try setting
"python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"]in User settings and reload window.
-
- addedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Aug 17, 2023 The issue should also go away if you update your Python extension to latest stable release.
Sure, here is the additional information:
Full output for `Python` in the `Output` panel after starting code and opening a Python project:
2023-08-18 08:11:44.024 [info] Experiment 'pythonaacf' is active 2023-08-18 08:11:44.024 [info] Experiment 'pythonDiscoveryModuleWithoutWatcher' is active 2023-08-18 08:11:44.024 [info] Experiment 'pythonTensorboardExperiment' is active 2023-08-18 08:11:44.025 [info] Test server listening. 2023-08-18 08:11:44.026 [info] Python interpreter path: /bin/python 2023-08-18 08:11:44.296 [error] [ 'Failed to activate a workspace, Class name = g, completed in 276ms, has a falsy return value, Arg 1: <Uri:/home/user/git/path/to/the/currently/open/pythonfile.py>, Return Value: undefined', [TypeError: this.context.getEnvironmentVariableCollection is not a function at _.activate (/home/user/.vscode/extensions/ms-python.python-2023.15.12221007/out/client/extension.js:2:440573) at /home/user/.vscode/extensions/ms-python.python-2023.15.12221007/out/client/extension.js:2:2386 at Array.map (<anonymous>) at g.activateWorkspace (/home/user/.vscode/extensions/ms-python.python-2023.15.12221007/out/client/extension.js:2:2376)] ] 2023-08-18 08:11:44.296 [error] Failure during activation. [TypeError: this.context.getEnvironmentVariableCollection is not a function at _.activate (/home/user/.vscode/extensions/ms-python.python-2023.15.12221007/out/client/extension.js:2:440573) at /home/user/.vscode/extensions/ms-python.python-2023.15.12221007/out/client/extension.js:2:2386 at Array.map (<anonymous>) at g.activateWorkspace (/home/patrick/.vscode/extensions/ms-python.python-2023.15.12221007/out/client/extension.js:2:2376)] 2023-08-18 08:11:44.296 [error] sendStartupTelemetry() failed. [TypeError: this.context.getEnvironmentVariableCollection is not a function at _.activate (/home/user/.vscode/extensions/ms-python.python-2023.15.12221007/out/client/extension.js:2:440573) at /home/user/.vscode/extensions/ms-python.python-2023.15.12221007/out/client/extension.js:2:2386 at Array.map (<anonymous>) at g.activateWorkspace (/home/user/.vscode/extensions/ms-python.python-2023.15.12221007/out/client/extension.js:2:2376)] 2023-08-18 08:11:44.829 [info] Starting Pylance language server. 2023-08-18 08:11:45.515 [info] LINTING: Skipping linting from Python extension, since Flake8 extension is installed and enabled.- When setting
"python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"]an additional line2023-08-18 08:15:42.235 [info] Experiment 'pythonTerminalEnvVarActivation' is inactiveshows up in the log, but otherwise everything is unchanged.
Indeed, this error does not show up anymore if I switch to the release version
v2023.14.0. The actual issue that "nothing" is working properly (e.g. no auto-completion, unable to jump to definitions via ctrl+click, ... - all the stuff one uses an IDE for) is still there (which was the reason I checked out the prerelease in the first place). So I guess the cause for that is a different issue - but without any error logs anywhere, I guess I'll have to search further myself.At least I was able to report some error in the pre-release version then...
- When setting
- removedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Aug 18, 2023 - addedbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugarea-editor-*User-facing catch-allUser-facing catch-allneeds PRReady to be worked onReady to be worked onand removedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Aug 18, 2023 - added a commit that references this issue
on Aug 18, 2023 Patrick Mischke (@Patschke) Please try updating your Python extension to latest pre-release version (with
"python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"]still being there), and see if you still run into the issue.- addedauthor-verification-requestedIssues potentially verifiable by issue authorIssues potentially verifiable by issue author
on Aug 18, 2023 - added a commit that references this issue
on Aug 18, 2023 ThibautHH commented
on Aug 18, 2023 More actionsI Just ran into the exact same problem, and the error did go away just fine with the latest pre-release version.
Thesettings.jsonline for the experiment does not seem to change anything at first glance (except the actual activation of it, of course).
However, I am still experiencing the no auto-completion/reference jumping like Patrick Mischke (@Patschke).Same x64 Linux kernel and VS Code version on my side.
Thibaut Hebert--Henriette (@ThibautHH) Thanks for verifying. Could you open a new issue for auto-completion using
Python: Report Issuecommand? We'll be happy to have a look.Reacted by Thibaut Hebert--Henriette- locked as resolved and limited conversation to collaborators
on Sep 18, 2023
Type: Bug
I'm running code version 1.81.1 and python 3.11.3 using Arch linux. I've tried the pre-release and release version of the python extension with identical results. The python extension won't load properly, the log shows an error as soon as I open any python workspace:
2023-08-17 10:19:17.604 [error] [ 'Failed to activate a workspace, Class name = g, completed in 256ms, has a falsy return value, Arg 1: , Return Value: undefined', [TypeError: this.context.getEnvironmentVariableCollection is not a function at _.activate (/home/user/.vscode/extensions/ms-python.python-2023.15.12221007/out/client/extension.js:2:440573) at /home/user/.vscode/extensions/ms-python.python-2023.15.12221007/out/client/extension.js:2:2386 at Array.map () at g.activateWorkspace (/home/user/.vscode/extensions/ms-python.python-2023.15.12221007/out/client/extension.js:2:2376)] ]A lot of stuff won't work (including the "Python: Report Issue..." command, but also basic stuff like auto completion, Ctrl+Click to jump to definitions, ...). I'm not sure if the cause of this is actually the error above, but I couldn't find anything else that looked suspicious. There were no issues before I recently updated from version 1.79.2 to 1.81.x.
I did not find any other reports that look similiar to this, so I'd guess it's an issue somewhere on my side. However, I was unable to find a solution, so I still ended up filing an issue to receive some support.
Extension version: 2023.15.12221007
VS Code version: Code 1.81.1 (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-11T08:12:48.924Z)
OS version: Linux x64 6.4.10-arch1-1
Modes:
System Info
canvas_oop_rasterization: disabled_off
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: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
A/B Experiments