microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.28k stars 1.17k forks source link

Prepended (.venv) when terminal shell already adds it #23736

Closed andyshinn closed 1 day ago

andyshinn commented 1 month ago

Type: Bug

Behaviour

I use the Starship shell integration with zsh on macOS. A recent version of this Python extension seems to not play nicely with it or has started prepending (.venv) to PS1 where it wasn't previously.

The logs for the Python extension show:

2024-07-03 12:19:51.032 [info] Prepending environment variable PS1 in collection with (.venv)  {"applyAtShellIntegration":true,"applyAtProcessCreation":false}

I didn't see any option to disable it. My shell now gets a new line added to it when (.venv) gets activated even though Starship already handles this:

(.venv) 
bridger on  main via 🐍 v3.12.4 (.venv) 
❯ 

Previously it would be:

bridger on  main via 🐍 v3.12.4 (.venv) 
❯ 

Screenshot example:

image

Steps to reproduce:

  1. Open VS Code in a Python project that has a .venv already created.
  2. Be sure to activate the virtual environment.
  3. Open a terminal where you have Starship with the .venv addon activated.

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

``` 2024-07-03 12:19:51.032 [info] Setting environment variable INFLUX_URL in collection to http://localhost:8086 {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-03 12:19:51.032 [info] Setting environment variable MANPATH in collection to /opt/homebrew/share/man:: {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-03 12:19:51.032 [info] Prepending environment variable PATH in collection with /Users/andy/.vscode/extensions/ms-python.python-2024.8.1/python_files/deactivate/zsh:/Users/andy/GitHub/andyshinn/bridger/.venv/bin: {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-03 12:19:51.032 [info] Setting environment variable VIRTUAL_ENV in collection to /Users/andy/GitHub/andyshinn/bridger/.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-03 12:19:51.032 [info] Prepending environment variable PS1 in collection with (.venv) {"applyAtShellIntegration":true,"applyAtProcessCreation":false} 2024-07-03 12:19:51.032 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to (.venv) {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-03 12:19:51.033 [info] Send text to terminal: /usr/bin/python3 /Users/andy/.vscode/extensions/ms-python.python-2024.8.1/python_files/printEnvVariablesToFile.py /Users/andy/.vscode/extensions/ms-python.python-2024.8.1/python_files/deactivate/zsh/envVars.txt 2024-07-03 12:19:51.867 [info] Starting Pylance language server. ```

Extension version: 2024.8.1 VS Code version: Code 1.91.0 (ea1445cc7016315d0f5728f8e8b12a45dc0a7286, 2024-07-01T18:53:23.353Z) OS version: Darwin arm64 23.5.0 Modes:

User Settings

``` venvFolders: "" languageServer: "Pylance" ```

Installed Extensions |Extension Name|Extension Id|Version| |---|---|---| |Astro|astro-build.astro-vscode|2.10.2| |Azure Repos|ms-vscode.azure-repos|0.38.0| |Black Formatter|ms-python.black-formatter|2024.2.0| |C/C++|ms-vscode.cpptools|1.20.5| |Dev Containers|ms-vscode-remote.remote-containers|0.369.0| |Docker|ms-azuretools.vscode-docker|1.29.1| |Flake8|ms-python.flake8|2023.10.0| |GitHub Actions|github.vscode-github-actions|0.26.3| |GitHub Copilot|GitHub.copilot|1.209.0| |GitHub Copilot Chat|GitHub.copilot-chat|0.16.1| |GitHub Pull Requests|GitHub.vscode-pull-request-github|0.90.0| |GitHub Repositories|GitHub.remotehub|0.62.0| |HashiCorp Terraform|hashicorp.terraform|2.31.0| |isort|ms-python.isort|2023.10.1| |JavaScript Debugger|ms-vscode.js-debug|1.91.0| |JavaScript Debugger Companion Extension|ms-vscode.js-debug-companion|1.1.2| |Live Preview|ms-vscode.live-server|0.4.13| |PHP Intelephense|bmewburn.vscode-intelephense-client|1.10.4| |Pylance|ms-python.vscode-pylance|2024.6.1| |Python|ms-python.python|2024.8.1| |Python Debugger|ms-python.debugpy|2024.6.0| |Remote - SSH|ms-vscode-remote.remote-ssh|0.112.0| |Remote - SSH: Editing Configuration Files|ms-vscode-remote.remote-ssh-edit|0.86.0| |Remote - Tunnels|ms-vscode.remote-server|1.5.2| |Remote Development|ms-vscode-remote.vscode-remote-extensionpack|0.25.0| |Remote Explorer|ms-vscode.remote-explorer|0.4.3| |Remote Repositories|ms-vscode.remote-repositories|0.40.0| |Table Visualizer for JavaScript Profiles|ms-vscode.vscode-js-profile-table|1.0.9| |WSL|ms-vscode-remote.remote-wsl|0.88.2|
System Info |Item|Value| |---|---| |CPUs|Apple M2 Ultra (24 x 2400)| |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
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|3, 3, 3| |Memory (System)|64.00GB (1.07GB free)| |Process Argv|--crash-reporter-id 2143d587-324d-4715-b992-cd833039eaea| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 vscrp:30673768 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 jchc7451:31067544 chatpanelt:31048053 dsvsc021:30996838 da93g388:31013173 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 2f103344:31071589 impr_priority:31082723 ```
anthonykim1 commented 1 month ago

Hello, Thank you for filing this issue. There has already been discussion around this: https://github.com/microsoft/vscode-python/issues/23304 and https://github.com/microsoft/vscode-python/issues/23137

Are you able to post:

It would be great if you can share contents inside your ~/.zshrc I want to see what is changing your PS1.

To help diagnose the issue, could you also further share:

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

``` XXX ```

anthonykim1 commented 1 month ago

@andyshinn Also when you say previously, do you mean in terminal instance outside of VS Code?

andyshinn commented 1 month ago

I meant that this wasn't a problem in previous weeks. It started happening after a recent VS Code or Python extension update.

My `.zshrc` after sanitizing is: ```shell # shellcheck shell=bash HISTFILE=~/.histfile HISTSIZE=100000 SAVEHIST=100000 setopt appendhistory setopt sharehistory bindkey -e zstyle :compinstall filename '/Users/ashinn/.zshrc' autoload -Uz compinit compinit autoload -Uz bashcompinit autoload zmv bashcompinit setopt NO_NOMATCH export HOMEBREW_GITHUB_API_TOKEN="" export HOMEBREW_NO_ENV_HINTS=1 export DOCKER_BUILDKIT=1 export _ARGCOMPLETE_SHELL=tcsh export NPM_CONFIG_FUND=false export NPM_CONFIG_AUDIT=false export KICS_QUERIES_PATH=/opt/homebrew/opt/kics/share/kics/assets/queries # export FZF_CTRL_R_OPTS="--no-sort" # export PATH="/opt/homebrew/opt/python@3.7/bin:$PATH" # export PATH="/opt/homebrew/opt/python@3.9/bin:$PATH" # export PATH="/opt/homebrew/opt/python@3.8/bin:$PATH" export PATH="/opt/homebrew/sbin:$PATH" export PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH" export VIRTUAL_ENV_DISABLE_PROMPT=1 alias dri='docker run --rm -ti' alias d='docker' alias g='git' # alias a='awsume' alias a='php artisan' alias t='terraform' alias s='ssh-add ~/.ssh/andy' alias p='podman' alias awsume="source awsume" eval "$(/opt/homebrew/bin/brew shellenv)" eval "$(/opt/homebrew/bin/starship init zsh --print-full-init)" eval "$(jump shell)" eval "$(direnv hook zsh)" # eval "$(rbenv init - zsh)" eval "$(mise activate zsh)" fpath=(~/.awsume/zsh-autocomplete/ $fpath) [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh function tfe() { if [ -z "$1" ]; then echo "Usage: tf " return fi local folder folder="$1"; shift pushd "$folder" > /dev/null || exit 1 command terraform "$@" popd > /dev/null || exit 1 } function find() { { LC_ALL=C command find -x "$@" 3>&2 2>&1 1>&3 | \ grep -v -e 'Permission denied' -e 'Operation not permitted' >&3; \ [ $? = 1 ]; \ } 3>&2 2>&1 } function decodests() { aws sts decode-authorization-message --encoded-message "$@" | jq '.DecodedMessage | fromjson' } ```
And the Python trace output: ``` 2024-07-09 16:42:15.997 [info] Experiment 'pythonCreateEnvOnPipInstall' is active 2024-07-09 16:42:15.997 [info] Experiment 'pythonRecommendTensorboardExt' is active 2024-07-09 16:42:15.997 [info] Experiment 'pythonTerminalEnvVarActivation' is active 2024-07-09 16:42:15.997 [info] Experiment 'pythonTestAdapter' is active 2024-07-09 16:42:15.997 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir '/Users/andy/GitHub/andyshinn/bridger/.pixi/envs' at Object.readdirSync (node:fs:1515:3) at t.readdirSync (node:electron/js2c/node_init:2:11289) at /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:574598 at /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:574789 at Array.map () at d.initWatchers (/Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:574507) at async d.ensureWatchersReady (/Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:536827)] { errno: -2, syscall: 'scandir', code: 'ENOENT', path: '/Users/andy/GitHub/andyshinn/bridger/.pixi/envs' } 2024-07-09 16:42:15.997 [error] Dir "/Users/andy/GitHub/andyshinn/bridger/.pixi/envs" is not watchable (directory does not exist) 2024-07-09 16:42:15.997 [info] Default formatter is set to null for workspace /Users/andy/GitHub/andyshinn/bridger 2024-07-09 16:42:15.997 [info] Python interpreter path: ./.venv/bin/python 2024-07-09 16:42:16.008 [info] > pyenv which python 2024-07-09 16:42:16.008 [info] cwd: . 2024-07-09 16:42:16.129 [info] > pixi --version 2024-07-09 16:42:16.129 [error] [Error: spawn pixi ENOENT at ChildProcess._handle.onexit (node:internal/child_process:286:19) at onErrorNT (node:internal/child_process:484:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] { errno: -2, code: 'ENOENT', syscall: 'spawn pixi', path: 'pixi', spawnargs: [ '--version' ] } 2024-07-09 16:42:16.129 [warning] could not find a pixi interpreter for the interpreter at /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:42:16.142 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/printEnvVariables.py 2024-07-09 16:42:16.142 [info] shell: zsh 2024-07-09 16:42:16.206 [info] > /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/printEnvVariables.py 2024-07-09 16:42:16.206 [info] shell: zsh 2024-07-09 16:42:16.236 [info] Setting environment variable MQTT_TOPIC in collection to egr/home/2/e/# {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:42:16.236 [info] Setting environment variable MQTT_BROKER in collection to 192.168.1.93 {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:42:16.236 [info] Setting environment variable MQTT_USER in collection to bridger-dev {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:42:16.236 [info] Setting environment variable INFLUXDB_V2_ORG in collection to shinncloud {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:42:16.236 [info] Setting environment variable INFLUXDB_V2_URL in collection to http://localhost:8086 {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:42:16.236 [info] Setting environment variable MANPATH in collection to /opt/homebrew/share/man:: {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:42:16.236 [info] Prepending environment variable PATH in collection with /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/deactivate/zsh:/Users/andy/GitHub/andyshinn/bridger/.venv/bin: {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:42:16.236 [info] Setting environment variable VIRTUAL_ENV in collection to /Users/andy/GitHub/andyshinn/bridger/.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:42:16.236 [info] Prepending environment variable PS1 in collection with (.venv) {"applyAtShellIntegration":true,"applyAtProcessCreation":false} 2024-07-09 16:42:16.236 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to (.venv) {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:42:16.237 [info] Send text to terminal: /usr/bin/python3 /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/printEnvVariablesToFile.py /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/deactivate/zsh/envVars.txt 2024-07-09 16:42:17.049 [info] Starting Pylance language server. 2024-07-09 16:42:20.594 [info] Running installed packages checker: { id: '/Users/andy/GitHub/andyshinn/bridger/.venv/bin/python', sysPrefix: '/Users/andy/GitHub/andyshinn/bridger/.venv', envType: 'Venv', envName: '.venv', envPath: '/Users/andy/GitHub/andyshinn/bridger/.venv', path: '/Users/andy/GitHub/andyshinn/bridger/.venv/bin/python', architecture: 1, sysVersion: '', version: { raw: '3.12.4', major: 3, minor: 12, patch: 4, build: [], prerelease: [] }, displayName: "Python 3.12.4 ('.venv')", detailedDisplayName: "Python 3.12.4 ('.venv': venv)", type: 'Virtual' } /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/installed_check.py /Users/andy/GitHub/andyshinn/bridger/requirements.in 2024-07-09 16:42:20.594 [info] > ./.venv/bin/python ~/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/installed_check.py ./requirements.in 2024-07-09 16:42:20.601 [info] Running installed packages checker: { id: '/Users/andy/GitHub/andyshinn/bridger/.venv/bin/python', sysPrefix: '/Users/andy/GitHub/andyshinn/bridger/.venv', envType: 'Venv', envName: '.venv', envPath: '/Users/andy/GitHub/andyshinn/bridger/.venv', path: '/Users/andy/GitHub/andyshinn/bridger/.venv/bin/python', architecture: 1, sysVersion: '', version: { raw: '3.12.4', major: 3, minor: 12, patch: 4, build: [], prerelease: [] }, displayName: "Python 3.12.4 ('.venv')", detailedDisplayName: "Python 3.12.4 ('.venv': venv)", type: 'Virtual' } /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/installed_check.py /Users/andy/GitHub/andyshinn/bridger/requirements.txt 2024-07-09 16:42:20.601 [info] > ./.venv/bin/python ~/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/installed_check.py ./requirements.txt 2024-07-09 16:47:26.502 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:27.123 [debug] Received shell integration sequence for zsh 2024-07-09 16:47:27.245 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:27.569 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:27.758 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:27.961 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:34.942 [info] Experiment 'pythonCreateEnvOnPipInstall' is active 2024-07-09 16:47:34.942 [info] Experiment 'pythonRecommendTensorboardExt' is active 2024-07-09 16:47:34.942 [info] Experiment 'pythonTerminalEnvVarActivation' is active 2024-07-09 16:47:34.942 [info] Experiment 'pythonTestAdapter' is active 2024-07-09 16:47:34.942 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir '/Users/andy/GitHub/andyshinn/bridger/.pixi/envs' at Object.readdirSync (node:fs:1515:3) at t.readdirSync (node:electron/js2c/node_init:2:11289) at /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:574598 at /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:574789 at Array.map () at d.initWatchers (/Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:574507) at async d.ensureWatchersReady (/Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:536827)] { errno: -2, syscall: 'scandir', code: 'ENOENT', path: '/Users/andy/GitHub/andyshinn/bridger/.pixi/envs' } 2024-07-09 16:47:34.942 [error] Dir "/Users/andy/GitHub/andyshinn/bridger/.pixi/envs" is not watchable (directory does not exist) 2024-07-09 16:47:34.942 [debug] Start watching file for changes /Users/andy/.conda/environments.txt 2024-07-09 16:47:34.942 [debug] Start watching: /Users/andy/.conda with pattern environments.txt using VSCode API 2024-07-09 16:47:34.942 [debug] Start watching root /Users/andy/GitHub/andyshinn/bridger for globs ["python","*/python","*/bin/python"] 2024-07-09 16:47:34.942 [debug] Start watching: /Users/andy/GitHub/andyshinn/bridger with pattern python using VSCode API 2024-07-09 16:47:34.942 [debug] Start watching: /Users/andy/GitHub/andyshinn/bridger with pattern */python using VSCode API 2024-07-09 16:47:34.942 [debug] Start watching: /Users/andy/GitHub/andyshinn/bridger with pattern */bin/python using VSCode API 2024-07-09 16:47:34.985 [info] Default formatter is set to null for workspace /Users/andy/GitHub/andyshinn/bridger 2024-07-09 16:47:34.986 [debug] Testing: Setting up watcher for /Users/andy/GitHub/andyshinn/bridger 2024-07-09 16:47:34.988 [debug] VS Code was not launched from the command line 2024-07-09 16:47:34.995 [debug] Needed to validate /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python with latest info 2024-07-09 16:47:34.995 [info] Python interpreter path: ./.venv/bin/python 2024-07-09 16:47:34.995 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:35.035 [debug] Dump environment variables { "MQTT_TOPIC": "egr/home/2/e/#", "MQTT_BROKER": "192.168.1.93", "MQTT_USER": "bridger-dev", "INFLUXDB_V2_ORG": "shinncloud", "INFLUXDB_V2_URL": "http://localhost:8086", "COMMAND_MODE": "unix2003", "DOCKER_BUILDKIT": "1", "ELECTRON_NO_ATTACH_CONSOLE": "1", "HOME": "/Users/andy", "HOMEBREW_CELLAR": "/opt/homebrew/Cellar", "HOMEBREW_NO_ENV_HINTS": "1", "HOMEBREW_PREFIX": "/opt/homebrew", "HOMEBREW_REPOSITORY": "/opt/homebrew", "INFOPATH": "/opt/homebrew/share/info:", "KICS_QUERIES_PATH": "/opt/homebrew/opt/kics/share/kics/assets/queries", "LANG": "en_US.UTF-8", "LOGNAME": "andy", "MANPATH": "/opt/homebrew/share/man::", "MISE_SHELL": "zsh", "MallocNanoZone": "0", "NPM_CONFIG_AUDIT": "false", "NPM_CONFIG_FUND": "false", "OLDPWD": "/Users/andy", "ORIGINAL_XDG_CURRENT_DESKTOP": "undefined", "PWD": "/Users/andy", "SHELL": "/bin/zsh", "SHLVL": "2", "SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.CXKxng9SOG/Listeners", "STARSHIP_SESSION_KEY": "2343525427451324", "STARSHIP_SHELL": "zsh", "TERM": "xterm-256color", "TERM_PROGRAM": "Apple_Terminal", "TERM_PROGRAM_VERSION": "453", "TERM_SESSION_ID": "3A6FFE48-FA6F-4122-9247-5EBAB2124D97", "TMPDIR": "/var/folders/hm/5tzdggxs72s_3h50x_vg4bpr0000gn/T/", "USER": "andy", "VSCODE_AMD_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess", "VSCODE_CLI": "1", "VSCODE_CODE_CACHE_PATH": "/Users/andy/Library/Application Support/Code/CachedData/ea1445cc7016315d0f5728f8e8b12a45dc0a7286", "VSCODE_CRASH_REPORTER_PROCESS_TYPE": "extensionHost", "VSCODE_CWD": "/Users/andy", "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true", "VSCODE_IPC_HOOK": "/Users/andy/Library/Application Support/Code/1.91-main.sock", "VSCODE_NLS_CONFIG": "{\"locale\":\"en-us\",\"osLocale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}", "VSCODE_PID": "77450", "XPC_FLAGS": "0x0", "XPC_SERVICE_NAME": "application.com.microsoft.VSCode.27117602.27117608.856DCF4E-1F4A-472B-A852-D2B270D0DF5E", "_ARGCOMPLETE_SHELL": "tcsh", "__CFBundleIdentifier": "com.microsoft.VSCode", "__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x0", "__MISE_DIFF": "eAFrXpyfk9KwOC+1vGFJQWJJxgQASssINA", "__MISE_ORIG_PATH": "/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Keybase.app/Contents/SharedSupport/bin:/Users/andy/.orbstack/bin", "__MISE_WATCH": "eAFtzCEOwjAUgGGPQKOm0CsdILgEwaCb5vWVNuleSd+yBFvNNXCIcQAugMASrkA4xJK5JXN/fvHlm/UBOX+X4siYWGgyF1FCJOtPovaMAoYum1iH3DECK/YEqPAcwb1t8zMP0hTHe/7Zv54jMkTQQbDTCQd3yroeZhNWUfwXd6RWtTopp9l1uF2tzabCCo00cid7FpRQ4Q", "ELECTRON_RUN_AS_NODE": "1", "PATH": "/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Keybase.app/Contents/SharedSupport/bin:/Users/andy/.orbstack/bin:/opt/homebrew/opt/fzf/bin" } 2024-07-09 16:47:35.036 [info] > pyenv which python 2024-07-09 16:47:35.036 [info] cwd: . 2024-07-09 16:47:35.038 [debug] [Error: Command failed: pyenv which python /bin/sh: pyenv: command not found at ChildProcess.exithandler (node:child_process:423:12) at ChildProcess.emit (node:events:526:35) at maybeClose (node:internal/child_process:1105:16) at Socket. (node:internal/child_process:457:11) at Socket.emit (node:events:514:28) at Pipe. (node:net:337:12)] { code: 127, killed: false, signal: null, cmd: 'pyenv which python' } 2024-07-09 16:47:35.050 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:35.050 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:35.050 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:35.182 [debug] Dump environment variables { "MQTT_TOPIC": "egr/home/2/e/#", "MQTT_BROKER": "192.168.1.93", "MQTT_USER": "bridger-dev", "INFLUXDB_V2_ORG": "shinncloud", "INFLUXDB_V2_URL": "http://localhost:8086", "COMMAND_MODE": "unix2003", "DOCKER_BUILDKIT": "1", "ELECTRON_NO_ATTACH_CONSOLE": "1", "HOME": "/Users/andy", "HOMEBREW_CELLAR": "/opt/homebrew/Cellar", "HOMEBREW_NO_ENV_HINTS": "1", "HOMEBREW_PREFIX": "/opt/homebrew", "HOMEBREW_REPOSITORY": "/opt/homebrew", "INFOPATH": "/opt/homebrew/share/info:", "KICS_QUERIES_PATH": "/opt/homebrew/opt/kics/share/kics/assets/queries", "LANG": "en_US.UTF-8", "LOGNAME": "andy", "MANPATH": "/opt/homebrew/share/man::", "MISE_SHELL": "zsh", "MallocNanoZone": "0", "NPM_CONFIG_AUDIT": "false", "NPM_CONFIG_FUND": "false", "OLDPWD": "/Users/andy", "ORIGINAL_XDG_CURRENT_DESKTOP": "undefined", "PWD": "/Users/andy", "SHELL": "/bin/zsh", "SHLVL": "2", "SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.CXKxng9SOG/Listeners", "STARSHIP_SESSION_KEY": "2343525427451324", "STARSHIP_SHELL": "zsh", "TERM": "xterm-256color", "TERM_PROGRAM": "Apple_Terminal", "TERM_PROGRAM_VERSION": "453", "TERM_SESSION_ID": "3A6FFE48-FA6F-4122-9247-5EBAB2124D97", "TMPDIR": "/var/folders/hm/5tzdggxs72s_3h50x_vg4bpr0000gn/T/", "USER": "andy", "VSCODE_AMD_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess", "VSCODE_CLI": "1", "VSCODE_CODE_CACHE_PATH": "/Users/andy/Library/Application Support/Code/CachedData/ea1445cc7016315d0f5728f8e8b12a45dc0a7286", "VSCODE_CRASH_REPORTER_PROCESS_TYPE": "extensionHost", "VSCODE_CWD": "/Users/andy", "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true", "VSCODE_IPC_HOOK": "/Users/andy/Library/Application Support/Code/1.91-main.sock", "VSCODE_NLS_CONFIG": "{\"locale\":\"en-us\",\"osLocale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}", "VSCODE_PID": "77450", "XPC_FLAGS": "0x0", "XPC_SERVICE_NAME": "application.com.microsoft.VSCode.27117602.27117608.856DCF4E-1F4A-472B-A852-D2B270D0DF5E", "_ARGCOMPLETE_SHELL": "tcsh", "__CFBundleIdentifier": "com.microsoft.VSCode", "__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x0", "__MISE_DIFF": "eAFrXpyfk9KwOC+1vGFJQWJJxgQASssINA", "__MISE_ORIG_PATH": "/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Keybase.app/Contents/SharedSupport/bin:/Users/andy/.orbstack/bin", "__MISE_WATCH": "eAFtzCEOwjAUgGGPQKOm0CsdILgEwaCb5vWVNuleSd+yBFvNNXCIcQAugMASrkA4xJK5JXN/fvHlm/UBOX+X4siYWGgyF1FCJOtPovaMAoYum1iH3DECK/YEqPAcwb1t8zMP0hTHe/7Zv54jMkTQQbDTCQd3yroeZhNWUfwXd6RWtTopp9l1uF2tzabCCo00cid7FpRQ4Q", "ELECTRON_RUN_AS_NODE": "1", "PATH": "/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Keybase.app/Contents/SharedSupport/bin:/Users/andy/.orbstack/bin:/opt/homebrew/opt/fzf/bin" } 2024-07-09 16:47:35.182 [debug] Getting pixi 2024-07-09 16:47:35.182 [debug] Probing pixi binary: pixi 2024-07-09 16:47:35.183 [info] > pixi --version 2024-07-09 16:47:35.184 [error] [Error: spawn pixi ENOENT at ChildProcess._handle.onexit (node:internal/child_process:286:19) at onErrorNT (node:internal/child_process:484:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] { errno: -2, code: 'ENOENT', syscall: 'spawn pixi', path: 'pixi', spawnargs: [ '--version' ] } 2024-07-09 16:47:35.184 [debug] Failed to find pixi: pixi 2024-07-09 16:47:35.184 [debug] No pixi binary found 2024-07-09 16:47:35.184 [warning] could not find a pixi interpreter for the interpreter at /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:35.197 [debug] Activation Commands received source /Users/andy/GitHub/andyshinn/bridger/.venv/bin/activate for shell /bin/zsh, resource /Users/andy/GitHub/andyshinn/bridger and interpreter /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:35.197 [debug] Activating Environment to capture Environment variables, . /Users/andy/GitHub/andyshinn/bridger/.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/printEnvVariables.py 2024-07-09 16:47:35.197 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/printEnvVariables.py 2024-07-09 16:47:35.197 [info] shell: zsh 2024-07-09 16:47:35.198 [debug] Extension ms-python.vscode-pylance accessed onDidChangeActiveEnvironmentPath with args: undefined 2024-07-09 16:47:35.198 [debug] Extension ms-python.vscode-pylance accessed onDidEnvironmentVariablesChange with args: undefined 2024-07-09 16:47:35.220 [debug] Activated environment variables for /Users/andy/GitHub/andyshinn/bridger { MQTT_TOPIC: 'egr/home/2/e/#', MQTT_BROKER: '192.168.1.93', MQTT_USER: 'bridger-dev', INFLUXDB_V2_ORG: 'shinncloud', INFLUXDB_V2_URL: 'http://localhost:8086', COMMAND_MODE: 'unix2003', DOCKER_BUILDKIT: '1', ELECTRON_NO_ATTACH_CONSOLE: '1', HOME: '/Users/andy', HOMEBREW_CELLAR: '/opt/homebrew/Cellar', HOMEBREW_NO_ENV_HINTS: '1', HOMEBREW_PREFIX: '/opt/homebrew', HOMEBREW_REPOSITORY: '/opt/homebrew', INFOPATH: '/opt/homebrew/share/info:', KICS_QUERIES_PATH: '/opt/homebrew/opt/kics/share/kics/assets/queries', LANG: 'en_US.UTF-8', LOGNAME: 'andy', MANPATH: '/opt/homebrew/share/man::', MISE_SHELL: 'zsh', MallocNanoZone: '0', NPM_CONFIG_AUDIT: 'false', NPM_CONFIG_FUND: 'false', OLDPWD: '/', ORIGINAL_XDG_CURRENT_DESKTOP: 'undefined', PWD: '/', SHELL: '/bin/zsh', SHLVL: '2', SSH_AUTH_SOCK: '/private/tmp/com.apple.launchd.CXKxng9SOG/Listeners', STARSHIP_SESSION_KEY: '2343525427451324', STARSHIP_SHELL: 'zsh', TERM: 'xterm-256color', TERM_PROGRAM: 'Apple_Terminal', TERM_PROGRAM_VERSION: '453', TERM_SESSION_ID: '3A6FFE48-FA6F-4122-9247-5EBAB2124D97', TMPDIR: '/var/folders/hm/5tzdggxs72s_3h50x_vg4bpr0000gn/T/', USER: 'andy', VSCODE_AMD_ENTRYPOINT: 'vs/workbench/api/node/extensionHostProcess', VSCODE_CLI: '1', VSCODE_CODE_CACHE_PATH: '/Users/andy/Library/Application Support/Code/CachedData/ea1445cc7016315d0f5728f8e8b12a45dc0a7286', VSCODE_CRASH_REPORTER_PROCESS_TYPE: 'extensionHost', VSCODE_CWD: '/Users/andy', VSCODE_HANDLES_UNCAUGHT_ERRORS: 'true', VSCODE_IPC_HOOK: '/Users/andy/Library/Application Support/Code/1.91-main.sock', VSCODE_NLS_CONFIG: '{"locale":"en-us","osLocale":"en-us","availableLanguages":{},"_languagePackSupport":true}', VSCODE_PID: '77450', XPC_FLAGS: '0x0', XPC_SERVICE_NAME: 'application.com.microsoft.VSCode.27117602.27117608.856DCF4E-1F4A-472B-A852-D2B270D0DF5E', _ARGCOMPLETE_SHELL: 'tcsh', __CFBundleIdentifier: 'com.microsoft.VSCode', __CF_USER_TEXT_ENCODING: '0x1F5:0x0:0x0', __MISE_DIFF: 'eAFrXpyfk9KwOC+1vGFJQWJJxgQASssINA', __MISE_ORIG_PATH: '/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Keybase.app/Contents/SharedSupport/bin:/Users/andy/.orbstack/bin', __MISE_WATCH: 'eAFtzCEOwjAUgGGPQKOm0CsdILgEwaCb5vWVNuleSd+yBFvNNXCIcQAugMASrkA4xJK5JXN/fvHlm/UBOX+X4siYWGgyF1FCJOtPovaMAoYum1iH3DECK/YEqPAcwb1t8zMP0hTHe/7Zv54jMkTQQbDTCQd3yroeZhNWUfwXd6RWtTopp9l1uF2tzabCCo00cid7FpRQ4Q', ELECTRON_RUN_AS_NODE: '1', PATH: '/Users/andy/GitHub/andyshinn/bridger/.venv/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Keybase.app/Contents/SharedSupport/bin:/Users/andy/.orbstack/bin:/opt/homebrew/opt/fzf/bin', PYTHONUNBUFFERED: '1', PYTHONIOENCODING: 'utf-8', VIRTUAL_ENV: '/Users/andy/GitHub/andyshinn/bridger/.venv', PS1: '(.venv) ', VIRTUAL_ENV_PROMPT: '(.venv) ', _: '/Users/andy/GitHub/andyshinn/bridger/.venv/bin/python' } 2024-07-09 16:47:35.220 [info] > /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/printEnvVariables.py 2024-07-09 16:47:35.220 [info] shell: zsh 2024-07-09 16:47:35.242 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:35.242 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:35.243 [info] Setting environment variable MQTT_TOPIC in collection to egr/home/2/e/# {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:47:35.243 [info] Setting environment variable MQTT_BROKER in collection to 192.168.1.93 {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:47:35.243 [info] Setting environment variable MQTT_USER in collection to bridger-dev {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:47:35.243 [info] Setting environment variable INFLUXDB_V2_ORG in collection to shinncloud {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:47:35.243 [info] Setting environment variable INFLUXDB_V2_URL in collection to http://localhost:8086 {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:47:35.243 [info] Setting environment variable MANPATH in collection to /opt/homebrew/share/man:: {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:47:35.243 [info] Prepending environment variable PATH in collection with /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/deactivate/zsh:/Users/andy/GitHub/andyshinn/bridger/.venv/bin: {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:47:35.243 [info] Setting environment variable VIRTUAL_ENV in collection to /Users/andy/GitHub/andyshinn/bridger/.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:47:35.243 [info] Prepending environment variable PS1 in collection with (.venv) {"applyAtShellIntegration":true,"applyAtProcessCreation":false} 2024-07-09 16:47:35.243 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to (.venv) {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-09 16:47:35.243 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:35.243 [info] Send text to terminal: /usr/bin/python3 /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/printEnvVariablesToFile.py /Users/andy/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/deactivate/zsh/envVars.txt 2024-07-09 16:47:35.256 [debug] Time taken to get env vars using terminal is 13ms 2024-07-09 16:47:35.438 [debug] Received shell integration sequence for zsh 2024-07-09 16:47:35.485 [debug] Received shell integration sequence for zsh 2024-07-09 16:47:35.580 [debug] Received shell integration sequence for zsh 2024-07-09 16:47:35.981 [info] Starting Pylance language server. 2024-07-09 16:47:35.981 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:35.983 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:35.983 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:35.984 [debug] Extension ms-python.vscode-pylance accessed getActiveEnvironmentPath with args: undefined 2024-07-09 16:47:35.985 [debug] Extension ms-python.vscode-pylance accessed resolveEnvironment with args: {"id":"/Users/andy/GitHub/andyshinn/bridger/.venv/bin/python","path":"/Users/andy/GitHub/andyshinn/bridger/.venv/bin/python"} 2024-07-09 16:47:35.985 [debug] Extension ms-python.vscode-pylance accessed resolveEnvironment with args: {"id":"/Users/andy/GitHub/andyshinn/bridger/.venv/bin/python","path":"/Users/andy/GitHub/andyshinn/bridger/.venv/bin/python"} 2024-07-09 16:47:35.985 [debug] Extension ms-python.vscode-pylance accessed getActiveEnvironmentPath with args: undefined 2024-07-09 16:47:35.985 [debug] Extension ms-python.vscode-pylance accessed getEnvironmentVariables with args: undefined 2024-07-09 16:47:37.608 [debug] Delay Trigger[Test Configuration Change]: triggered=1, called=1 2024-07-09 16:47:40.992 [debug] Terminal shell path '/bin/zsh' identified as shell 'zsh' 2024-07-09 16:47:40.992 [debug] Shell identified as zsh 2024-07-09 16:47:40.992 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:41.763 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python 2024-07-09 16:47:41.764 [debug] Found cached env for /Users/andy/GitHub/andyshinn/bridger/.venv/bin/python ```
anthonykim1 commented 1 day ago

Apologies for late response and thanks again for this detailed log here. We've had very similar issue: Give this a read: https://github.com/microsoft/vscode-python/issues/23137.

Way to resolve this would be https://github.com/microsoft/vscode-python/issues/23159 so please feel free to go give a thumbs up. This is the limitation we currently have with the new terminal env variable activation since we do not have context of user's shell initialization file, it should be resolved once https://github.com/microsoft/vscode-python/issues/23159 is taken care of. Lets track the issue there but let me know if you have any other questions. Thanks.