Skip to content

[BUG] VS Code python.envFile does not seem to work with python.defaultInterpreterPath #19276

Description

@sugatoray

Discussed in #19275

Originally posted by sugatoray June 10, 2022
Despite specifying a python.envFile in workspace (.vscode/settings.json), python.defaultInterpreterPath does not seem to fetch the interpreter path via an environment variable, declared in the envFile.

# filename: .env
# set this in .vscode/settings.json:
# "python.envFile": "${workspaceFolder}/.env"
DEFAULT_INTERPRETER_PATH=path/to/python/interepreter
// filename: .vscode/settings.json
{
    "python.envFile": "${workspaceFolder}/.env",
    "python.defaultInterpreterPath": "${env:DEFAULT_INTERPRETER_PATH}",
    "python.terminal.activateEnvironment": true,
    "python.terminal.activateEnvInCurrentTerminal": false,
    "jupyter.jupyterServerType": "local",
}

If I hard code the python.defaultInterpreterPath, it works, and auto activates the interpreter, when I open a new terminal window. But it does not activate the the interpreter from the variable (in .env file).

References

🔥 Note

I have raised this as a question on stackoverflow already.


Does this issue occur when all extensions are disabled?: Yes/No

I have not and can't afford to check that as I don't know a programmatic way of restoring current extensions state.

Diagnostics Info:

Version: 1.67.2
Commit: c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5
Date: 2022-05-17T18:23:40.286Z
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Linux x64 5.13.0-44-generic snap

Steps to Reproduce:

Follow the description given above.


💡 I have opened another issue here:

I was told to contact with vscode-python by the vscode team.

Metadata

Metadata

Labels

area-editor-*User-facing catch-allbugIssue identified by VS Code Team member as probable buginvestigatingWe are looking into the cause of the issuetriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions