Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS Code adds to PS1 when it shouldn't #22882

Closed
karrtikr opened this issue Feb 8, 2024 · 9 comments
Closed

VS Code adds to PS1 when it shouldn't #22882

karrtikr opened this issue Feb 8, 2024 · 9 comments
Assignees
Labels
experimenting Feature is part of an experiment triage-needed Needs assignment to the proper sub-team

Comments

@karrtikr
Copy link

karrtikr commented Feb 8, 2024

I have this annoying issue where VSCode adds stuff to my PS1. In this case I'm using pyenv, but it happens with conda as well.
image
system is what should be in PS1, the yt part is there only because I selected it in the bottom right corner in the Python extension.

Any chance it's related to any of the issues in the main post?
Similar to @JoelFeiner-viimed I tried downgrading the extension or switching to the pre-release version, without any luck.

Originally posted by @gabethehuman in #22879 (comment)

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 8, 2024
@karrtikr
Copy link
Author

karrtikr commented Feb 8, 2024

@gabethehuman I have a few questions:

  • Could you help with what type of pyenv environment that is, is it a virtual environment?
  • If so, what command do you use to activate it?

Please provide the debug logs which can help diagnose the issue:

  • Run Developer: Set log level command
  • Select Trace
  • Run Developer: Reload Window command
  • Provide the output:
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

@karrtikr karrtikr added the experimenting Feature is part of an experiment label Feb 8, 2024
@karrtikr karrtikr self-assigned this Feb 8, 2024
@gabethehuman
Copy link

Sure, I'll give you whatever info you need.
This is a virtual environment created by pyenv virtualenv.
To activate it in a current shell I use pyenv shell yt, from what pyenv documentations say, pyenv activate yt has the same effect.
Previously, when I selected a venv, for example yt, in the bottom right corner, and then when I would open up a new terminal, it would activate this venv for me and the PS1 would be correct. Right now there's some weird dynamics between my .bashrc and the VSCode terminal prompt.

This is my .bashrc (the relevant part):

Details

# -------------------------------------------------------
# ---------------- pyenv stuff --------------------------
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"


eval "$(pyenv virtualenv-init -)"
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
UpdatePrompt() {
    RED='\[\e[0;31m\]'
    GREEN='\[\e[0;32m\]'
    BLUE='\[\e[0;34m\]'
    RESET='\[\e[0m\]'
    [ -z "$PYENV_VIRTUALENV_ORIGINAL_PS1" ] && export PYENV_VIRTUALENV_ORIGINAL_PS1="$PS1"
    [ -z "$PYENV_VIRTUALENV_GLOBAL_NAME" ] && export PYENV_VIRTUALENV_GLOBAL_NAME="$(pyenv global)"
    VENV_NAME="$(pyenv version-name)"
    VENV_NAME="${VENV_NAME##*/}"
    GLOBAL_NAME="$PYENV_VIRTUALENV_GLOBAL_NAME"

    # non-global versions:
    COLOR="$BLUE"
    # global version:
    [ "$VENV_NAME" == "$GLOBAL_NAME" ] && COLOR="$RED"
    # virtual envs:
    [ "${VIRTUAL_ENV##*/}" == "$VENV_NAME" ] && COLOR="$GREEN"

    if [ -z "$COLOR" ]; then
        PS1="$PYENV_VIRTUALENV_ORIGINAL_PS1"
    else
        PS1="($COLOR${VENV_NAME}$RESET)$PYENV_VIRTUALENV_ORIGINAL_PS1"
    fi
    export PS1
}
export PROMPT_COMMAND="$PROMPT_COMMAND UpdatePrompt;"

And here is the output:

Details

2024-02-08 20:05:58.556 [info] Experiment 'pythonaa' is active
2024-02-08 20:05:58.556 [info] Experiment 'pythonDiscoveryUsingWorkers' is active
2024-02-08 20:05:58.556 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-02-08 20:05:58.556 [info] Experiment 'pythonREPLSmartSend' is active
2024-02-08 20:05:58.556 [info] Experiment 'pythonSurveyNotificationcf' is active
2024-02-08 20:05:58.556 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-02-08 20:05:58.556 [info] Experiment 'pythonTestAdapter' is active
2024-02-08 20:05:58.556 [debug] Getting roots
2024-02-08 20:05:58.556 [debug] Getting roots
2024-02-08 20:05:58.556 [debug] Found roots
2024-02-08 20:05:58.556 [debug] Start watching file for changes /home/gabe/.conda/environments.txt
2024-02-08 20:05:58.556 [debug] Start watching: /home/gabe/.conda with pattern environments.txt using VSCode API
2024-02-08 20:05:58.556 [debug] Found roots
2024-02-08 20:05:58.556 [debug] Start watching root /mnt/f/dev/hms-kaggle for globs ["python","*/python","*/bin/python"]
2024-02-08 20:05:58.556 [debug] Start watching: /mnt/f/dev/hms-kaggle with pattern python using VSCode API
2024-02-08 20:05:58.556 [debug] Start watching: /mnt/f/dev/hms-kaggle with pattern */python using VSCode API
2024-02-08 20:05:58.556 [debug] Start watching: /mnt/f/dev/hms-kaggle with pattern */bin/python using VSCode API
2024-02-08 20:05:58.556 [info] Default formatter is set to charliermarsh.ruff for workspace /mnt/f/dev/hms-kaggle
2024-02-08 20:05:58.556 [debug] Waiting for test server to start...
2024-02-08 20:05:58.556 [info] Test server listening.
2024-02-08 20:05:58.556 [debug] Test server started.
2024-02-08 20:05:58.556 [debug] Testing: Setting up watcher for /mnt/f/dev/hms-kaggle
2024-02-08 20:05:58.556 [debug] Needed to validate /bin/python3 with latest info
2024-02-08 20:05:58.556 [debug] Needed to validate /usr/bin/python3 with latest info
2024-02-08 20:05:58.556 [debug] Needed to validate /home/gabe/.pyenv/versions/3.10.13/envs/kaggle/bin/python with latest info
2024-02-08 20:05:58.556 [debug] Needed to validate /home/gabe/.pyenv/versions/3.10.12/bin/python with latest info
2024-02-08 20:05:58.556 [debug] Needed to validate /home/gabe/.pyenv/versions/3.10.13/bin/python with latest info
2024-02-08 20:05:58.556 [debug] Needed to validate /home/gabe/.pyenv/versions/3.10.12/envs/book/bin/python with latest info
2024-02-08 20:05:58.556 [debug] Needed to validate /home/gabe/.pyenv/versions/3.10.12/envs/ml-models/bin/python with latest info
2024-02-08 20:05:58.556 [debug] Needed to validate /home/gabe/.pyenv/versions/3.10.12/envs/prob/bin/python with latest info
2024-02-08 20:05:58.556 [debug] Needed to validate /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python with latest info
2024-02-08 20:05:58.556 [debug] Needed to validate /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python with latest info
2024-02-08 20:05:58.556 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:58.556 [debug] Needed to validate /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python with latest info
2024-02-08 20:05:58.556 [info] Python interpreter path: ~/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:58.556 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:58.556 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:58.556 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:58.556 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:58.556 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:58.556 [debug] Storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS  retrying by resetting first
2024-02-08 20:05:58.556 [debug] Storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS  retrying by resetting first
2024-02-08 20:05:58.556 [debug] Storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS  retrying by resetting first
2024-02-08 20:05:58.556 [debug] Storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS  retrying by resetting first
2024-02-08 20:05:58.556 [debug] Storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS  retrying by resetting first
2024-02-08 20:05:58.556 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.13/bin/python
2024-02-08 20:05:58.573 [debug] Storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS  retrying by resetting first
2024-02-08 20:05:58.573 [debug] Storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS  retrying by resetting first
2024-02-08 20:05:58.573 [debug] Storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS  retrying by resetting first
2024-02-08 20:05:58.573 [debug] Storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS  retrying by resetting first
2024-02-08 20:05:58.577 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:58.597 [debug] Extension ms-toolsai.jupyter accessed onDidChangeEnvironments with args: undefined
2024-02-08 20:05:58.599 [debug] Extension ms-toolsai.jupyter accessed getEnvironmentVariables with args: undefined
2024-02-08 20:05:58.600 [debug] Extension ms-toolsai.jupyter accessed known with args: undefined
2024-02-08 20:05:58.601 [debug] Extension ms-toolsai.jupyter accessed onDidChangeEnvironments with args: undefined
2024-02-08 20:05:58.602 [debug] Extension ms-toolsai.jupyter accessed onDidEnvironmentVariablesChange with args: undefined
2024-02-08 20:05:58.603 [debug] Extension ms-toolsai.jupyter accessed onDidChangeActiveEnvironmentPath with args: undefined
2024-02-08 20:05:58.604 [debug] Extension ms-toolsai.jupyter accessed onDidEnvironmentVariablesChange with args: undefined
2024-02-08 20:05:58.605 [debug] Extension ms-toolsai.jupyter accessed onDidChangeEnvironments with args: undefined
2024-02-08 20:05:58.606 [debug] Extension ms-toolsai.jupyter accessed known with args: undefined
2024-02-08 20:05:58.607 [debug] Extension ms-toolsai.jupyter accessed known with args: undefined
2024-02-08 20:05:58.608 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/bin/python3","id":"/bin/python3","executable":{"uri":{"$mid":1,"path":"/bin/python3","scheme":"file"},"bitness":"64-bit","sysPrefix":"/usr"},"version":{"major":3,"minor":10,"micro":6,"release":{"level":"final","serial":0},"sysVersion":"3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]"},"tools":[]},"id":"/bin/python3"}
2024-02-08 20:05:58.609 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/usr/bin/python3","id":"/usr/bin/python3","executable":{"uri":{"$mid":1,"path":"/usr/bin/python3","scheme":"file"},"bitness":"64-bit","sysPrefix":"/usr"},"version":{"major":3,"minor":10,"micro":6,"release":{"level":"final","serial":0},"sysVersion":"3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]"},"tools":[]},"id":"/usr/bin/python3"}
2024-02-08 20:05:58.609 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/home/gabe/.pyenv/versions/3.10.13/envs/kaggle/bin/python","id":"/home/gabe/.pyenv/versions/3.10.13/envs/kaggle/bin/python","executable":{"uri":{"$mid":1,"path":"/home/gabe/.pyenv/versions/3.10.13/envs/kaggle/bin/python","scheme":"file"},"bitness":"64-bit","sysPrefix":"/home/gabe/.pyenv/versions/3.10.13/envs/kaggle"},"environment":{"type":"VirtualEnvironment","name":"kaggle","folderUri":{"$mid":1,"path":"/home/gabe/.pyenv/versions/3.10.13/envs/kaggle","scheme":"file"}},"version":{"major":3,"minor":10,"micro":13,"release":{"level":"final","serial":0},"sysVersion":"3.10.13 (main, Feb  2 2024, 13:28:56) [GCC 11.3.0]"},"tools":["Pyenv"]},"id":"/home/gabe/.pyenv/versions/3.10.13/envs/kaggle/bin/python"}
2024-02-08 20:05:58.610 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/home/gabe/.pyenv/versions/3.10.12/bin/python","id":"/home/gabe/.pyenv/versions/3.10.12/bin/python","executable":{"uri":{"$mid":1,"path":"/home/gabe/.pyenv/versions/3.10.12/bin/python","scheme":"file"},"bitness":"64-bit","sysPrefix":"/home/gabe/.pyenv/versions/3.10.12"},"version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 (main, Jun  7 2023, 21:46:12) [GCC 11.3.0]"},"tools":["Pyenv"]},"id":"/home/gabe/.pyenv/versions/3.10.12/bin/python"}
2024-02-08 20:05:58.611 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/home/gabe/.pyenv/versions/3.10.12/envs/book/bin/python","id":"/home/gabe/.pyenv/versions/3.10.12/envs/book/bin/python","executable":{"uri":{"$mid":1,"path":"/home/gabe/.pyenv/versions/3.10.12/envs/book/bin/python","scheme":"file"},"bitness":"64-bit","sysPrefix":"/home/gabe/.pyenv/versions/3.10.12/envs/book"},"environment":{"type":"VirtualEnvironment","name":"book","folderUri":{"$mid":1,"path":"/home/gabe/.pyenv/versions/3.10.12/envs/book","scheme":"file"}},"version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 (main, Jun  7 2023, 21:46:12) [GCC 11.3.0]"},"tools":["Pyenv"]},"id":"/home/gabe/.pyenv/versions/3.10.12/envs/book/bin/python"}
2024-02-08 20:05:58.612 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/home/gabe/.pyenv/versions/3.10.13/bin/python","id":"/home/gabe/.pyenv/versions/3.10.13/bin/python","executable":{"uri":{"$mid":1,"path":"/home/gabe/.pyenv/versions/3.10.13/bin/python","scheme":"file"},"bitness":"64-bit","sysPrefix":"/home/gabe/.pyenv/versions/3.10.13"},"version":{"major":3,"minor":10,"micro":13,"release":{"level":"final","serial":0},"sysVersion":"3.10.13 (main, Feb  2 2024, 13:28:56) [GCC 11.3.0]"},"tools":["Pyenv"]},"id":"/home/gabe/.pyenv/versions/3.10.13/bin/python"}
2024-02-08 20:05:58.613 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/home/gabe/.pyenv/versions/3.10.12/envs/ml-models/bin/python","id":"/home/gabe/.pyenv/versions/3.10.12/envs/ml-models/bin/python","executable":{"uri":{"$mid":1,"path":"/home/gabe/.pyenv/versions/3.10.12/envs/ml-models/bin/python","scheme":"file"},"bitness":"64-bit","sysPrefix":"/home/gabe/.pyenv/versions/3.10.12/envs/ml-models"},"environment":{"type":"VirtualEnvironment","name":"ml-models","folderUri":{"$mid":1,"path":"/home/gabe/.pyenv/versions/3.10.12/envs/ml-models","scheme":"file"}},"version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 (main, Jun  7 2023, 21:46:12) [GCC 11.3.0]"},"tools":["Pyenv"]},"id":"/home/gabe/.pyenv/versions/3.10.12/envs/ml-models/bin/python"}
2024-02-08 20:05:58.614 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/home/gabe/.pyenv/versions/3.10.12/envs/prob/bin/python","id":"/home/gabe/.pyenv/versions/3.10.12/envs/prob/bin/python","executable":{"uri":{"$mid":1,"path":"/home/gabe/.pyenv/versions/3.10.12/envs/prob/bin/python","scheme":"file"},"bitness":"64-bit","sysPrefix":"/home/gabe/.pyenv/versions/3.10.12/envs/prob"},"environment":{"type":"VirtualEnvironment","name":"prob","folderUri":{"$mid":1,"path":"/home/gabe/.pyenv/versions/3.10.12/envs/prob","scheme":"file"}},"version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 (main, Jun  7 2023, 21:46:12) [GCC 11.3.0]"},"tools":["Pyenv"]},"id":"/home/gabe/.pyenv/versions/3.10.12/envs/prob/bin/python"}
2024-02-08 20:05:58.615 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","id":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","executable":{"uri":{"$mid":1,"fsPath":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","scheme":"file"},"bitness":"64-bit","sysPrefix":"/home/gabe/.pyenv/versions/3.10.12/envs/yt"},"environment":{"type":"VirtualEnvironment","name":"yt","folderUri":{"$mid":1,"path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt","scheme":"file"}},"version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 (main, Jun  7 2023, 21:46:12) [GCC 11.3.0]"},"tools":["Pyenv"]},"id":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python"}
2024-02-08 20:05:58.616 [debug] Extension ms-toolsai.jupyter accessed getActiveEnvironmentPath with args: undefined
2024-02-08 20:05:58.617 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"id":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python"}
2024-02-08 20:05:58.620 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-02-08 20:05:58.620 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-02-08 20:05:58.620 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-02-08 20:05:58.620 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-02-08 20:05:58.620 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-02-08 20:05:58.622 [debug] Extension ms-toolsai.jupyter accessed known with args: undefined
2024-02-08 20:05:58.623 [debug] Extension ms-toolsai.jupyter accessed known with args: undefined
2024-02-08 20:05:58.624 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","id":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","executable":{"uri":{"$mid":1,"fsPath":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","scheme":"file"},"bitness":"64-bit","sysPrefix":"/home/gabe/.pyenv/versions/3.10.12/envs/yt"},"environment":{"type":"VirtualEnvironment","name":"yt","folderUri":{"$mid":1,"path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt","scheme":"file"}},"version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 (main, Jun  7 2023, 21:46:12) [GCC 11.3.0]"},"tools":["Pyenv"]},"id":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python"}
2024-02-08 20:05:58.651 [debug] Searching for conda.
2024-02-08 20:05:58.664 [debug] Probing conda binary: conda
2024-02-08 20:05:58.692 [debug] Extension ms-toolsai.jupyter accessed getEnvironmentVariables with args: undefined
2024-02-08 20:05:58.699 [debug] Dump environment variables {
    "USER": "gabe",
    "VSCODE_WSL_EXT_LOCATION": "/mnt/c/Users/Gabe/.vscode/extensions/ms-vscode-remote.remote-wsl-0.86.0",
    "SHLVL": "0",
    "HOME": "/home/gabe",
    "WSL_DISTRO_NAME": "Ubuntu-22.04",
    "LOGNAME": "gabe",
    "NAME": "GabePC",
    "WSL_INTEROP": "/run/WSL/15_interop",
    "_": "/home/gabe/.vscode-server/bin/31c37ee8f63491495ac49e43b8544550fbae4533/node",
    "TERM": "xterm-256color",
    "LANG": "C.UTF-8",
    "SHELL": "/bin/bash",
    "PWD": "/mnt/c/Program Files/Microsoft VS Code",
    "HOSTTYPE": "x86_64",
    "WSLENV": "VSCODE_WSL_EXT_LOCATION/up",
    "VSCODE_HANDLES_SIGPIPE": "true",
    "PYENV_SHELL": "bash",
    "PYENV_VIRTUALENV_DISABLE_PROMPT": "1",
    "PYENV_VIRTUALENV_INIT": "1",
    "LS_COLORS": "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:",
    "PROMPT_COMMAND": "_pyenv_virtualenv_hook;history -a; UpdatePrompt;",
    "LESSCLOSE": "/usr/bin/lesspipe %s %s",
    "LESSOPEN": "| /usr/bin/lesspipe %s",
    "PS1": "\\[\\033[01;32m\\]\\u\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\[\\033[01;33m\\]$(parse_git_branch)\\[\\033[00m\\]$ ",
    "PYENV_ROOT": "/home/gabe/.pyenv",
    "XDG_DATA_DIRS": "/usr/local/share:/usr/share:/var/lib/snapd/desktop",
    "VSCODE_AMD_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess",
    "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
    "VSCODE_NLS_CONFIG": "{\"locale\":\"en\",\"osLocale\":\"en\",\"availableLanguages\":{}}",
    "VSCODE_CWD": "/mnt/c/Program Files/Microsoft VS Code",
    "ELECTRON_RUN_AS_NODE": "1",
    "VSCODE_IPC_HOOK_CLI": "/tmp/vscode-ipc-6698d8fa-7246-46b5-94f7-31f52ac9c626.sock",
    "PATH": "/home/gabe/.vscode-server/bin/31c37ee8f63491495ac49e43b8544550fbae4533/bin/remote-cli:/home/gabe/.pyenv/shims:/home/gabe/.pyenv/plugins/pyenv-virtualenv/shims:/home/gabe/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Program Files/Calibre2/:/mnt/c/Users/Gabe/scoop/shims:/mnt/c/Users/Gabe/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Gabe/.dotnet/tools:/mnt/c/haskell-stuff/ghcup/bin:/mnt/d/miniconda3/Scripts/:/snap/bin"
}
2024-02-08 20:05:58.701 [info] > conda info --json
2024-02-08 20:05:58.701 [debug] Worker id 4 for file plainExec.worker.js with data {"file":"conda","args":["info","--json"],"options":{"timeout":45000,"useWorker":true}}
2024-02-08 20:05:58.704 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-02-08 20:05:58.704 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-02-08 20:05:58.704 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-02-08 20:05:58.704 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-02-08 20:05:58.712 [debug] Extension charliermarsh.ruff accessed onDidChangeActiveEnvironmentPath with args: undefined
2024-02-08 20:05:58.712 [debug] Extension charliermarsh.ruff accessed getActiveEnvironmentPath with args: undefined
2024-02-08 20:05:58.713 [debug] Extension charliermarsh.ruff accessed resolveEnvironment with args: {"id":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python"}
2024-02-08 20:05:58.714 [debug] Extension charliermarsh.ruff accessed getActiveEnvironmentPath with args: undefined
2024-02-08 20:05:58.714 [debug] Extension charliermarsh.ruff accessed resolveEnvironment with args: {"id":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python"}
2024-02-08 20:05:58.715 [debug] Extension charliermarsh.ruff accessed getActiveEnvironmentPath with args: undefined
2024-02-08 20:05:58.716 [debug] Extension charliermarsh.ruff accessed resolveEnvironment with args: {"id":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python"}
2024-02-08 20:05:58.717 [debug] Extension charliermarsh.ruff accessed getActiveEnvironmentPath with args: undefined
2024-02-08 20:05:58.718 [debug] Extension charliermarsh.ruff accessed resolveEnvironment with args: {"id":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python"}
2024-02-08 20:05:58.745 [debug] Activation Commands received source /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/activate for shell bash, resource /mnt/f/dev/hms-kaggle and interpreter /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:58.745 [debug] Activating Environment to capture Environment variables, . /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /home/gabe/.vscode-server/extensions/ms-python.python-2024.1.10391007/pythonFiles/printEnvVariables.py
2024-02-08 20:05:58.745 [info] > . ~/.pyenv/versions/3.10.12/envs/yt/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode-server/extensions/ms-python.python-2024.1.10391007/pythonFiles/printEnvVariables.py
2024-02-08 20:05:58.745 [info] shell: bash
2024-02-08 20:05:58.747 [debug] Extension ms-python.vscode-pylance accessed onDidEnvironmentVariablesChange with args: undefined
2024-02-08 20:05:58.749 [debug] Extension ms-python.vscode-pylance accessed onDidChangeActiveEnvironmentPath with args: undefined
2024-02-08 20:05:58.808 [debug] Failed to spawn conda binary conda Error: spawn conda ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
2024-02-08 20:05:58.809 [debug] Couldn't locate the conda binary.
2024-02-08 20:05:59.172 [debug] Clearing context for python dependencies not installed: /mnt/f/dev/hms-kaggle/eeg/train.py
2024-02-08 20:05:59.625 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:59.640 [info] Starting Pylance language server.
2024-02-08 20:05:59.641 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:59.648 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:59.650 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:59.680 [debug] Activation Commands received source /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/activate for shell /bin/bash, resource /mnt/f/dev/hms-kaggle and interpreter /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:59.680 [debug] Activating Environment to capture Environment variables, . /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /home/gabe/.vscode-server/extensions/ms-python.python-2024.1.10391007/pythonFiles/printEnvVariables.py
2024-02-08 20:05:59.680 [info] > . ~/.pyenv/versions/3.10.12/envs/yt/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode-server/extensions/ms-python.python-2024.1.10391007/pythonFiles/printEnvVariables.py
2024-02-08 20:05:59.680 [info] shell: bash
2024-02-08 20:05:59.685 [debug] Extension ms-python.vscode-pylance accessed getActiveEnvironmentPath with args: undefined
2024-02-08 20:05:59.685 [debug] Extension ms-python.vscode-pylance accessed resolveEnvironment with args: {"id":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python"}
2024-02-08 20:05:59.686 [debug] Extension ms-python.vscode-pylance accessed getActiveEnvironmentPath with args: undefined
2024-02-08 20:05:59.687 [debug] Extension ms-python.vscode-pylance accessed getEnvironmentVariables with args: undefined
2024-02-08 20:05:59.688 [debug] Extension ms-python.vscode-pylance accessed resolveEnvironment with args: {"id":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python","path":"/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python"}
2024-02-08 20:05:59.702 [debug] Activated environment variables for /mnt/f/dev/hms-kaggle {
  SHELL: '/bin/bash',
  PYENV_SHELL: 'bash',
  PYTHONUNBUFFERED: '1',
  WSL_DISTRO_NAME: 'Ubuntu-22.04',
  ELECTRON_RUN_AS_NODE: '1',
  PYENV_VIRTUALENV_DISABLE_PROMPT: '1',
  VSCODE_AMD_ENTRYPOINT: 'vs/workbench/api/node/extensionHostProcess',
  NAME: 'GabePC',
  PWD: '/mnt/c/Program Files/Microsoft VS Code',
  PYENV_VIRTUALENV_INIT: '1',
  LOGNAME: 'gabe',
  HOME: '/home/gabe',
  LANG: 'C.UTF-8',
  WSL_INTEROP: '/run/WSL/15_interop',
  LS_COLORS: 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:',
  VIRTUAL_ENV: '/home/gabe/.pyenv/versions/3.10.12/envs/yt',
  PROMPT_COMMAND: '_pyenv_virtualenv_hook;history -a; UpdatePrompt;',
  LESSCLOSE: '/usr/bin/lesspipe %s %s',
  VSCODE_HANDLES_SIGPIPE: 'true',
  TERM: 'xterm-256color',
  LESSOPEN: '| /usr/bin/lesspipe %s',
  USER: 'gabe',
  PYTHONIOENCODING: 'utf-8',
  SHLVL: '0',
  VSCODE_CWD: '/mnt/c/Program Files/Microsoft VS Code',
  VIRTUAL_ENV_PROMPT: '(yt) ',
  PS1: '(yt) ',
  PYENV_ROOT: '/home/gabe/.pyenv',
  WSLENV: 'VSCODE_WSL_EXT_LOCATION/up',
  VSCODE_WSL_EXT_LOCATION: '/mnt/c/Users/Gabe/.vscode/extensions/ms-vscode-remote.remote-wsl-0.86.0',
  XDG_DATA_DIRS: '/usr/local/share:/usr/share:/var/lib/snapd/desktop',
  PATH: '/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin:/home/gabe/.vscode-server/bin/31c37ee8f63491495ac49e43b8544550fbae4533/bin/remote-cli:/home/gabe/.pyenv/shims:/home/gabe/.pyenv/plugins/pyenv-virtualenv/shims:/home/gabe/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Program Files/Calibre2/:/mnt/c/Users/Gabe/scoop/shims:/mnt/c/Users/Gabe/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Gabe/.dotnet/tools:/mnt/c/haskell-stuff/ghcup/bin:/mnt/d/miniconda3/Scripts/:/snap/bin',
  VSCODE_NLS_CONFIG: '{"locale":"en","osLocale":"en","availableLanguages":{}}',
  HOSTTYPE: 'x86_64',
  VSCODE_HANDLES_UNCAUGHT_ERRORS: 'true',
  VSCODE_IPC_HOOK_CLI: '/tmp/vscode-ipc-6698d8fa-7246-46b5-94f7-31f52ac9c626.sock',
  _: '/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python'
}
2024-02-08 20:05:59.717 [info] > /bin/python3 ~/.vscode-server/extensions/ms-python.python-2024.1.10391007/pythonFiles/printEnvVariables.py
2024-02-08 20:05:59.717 [info] shell: bash
2024-02-08 20:05:59.733 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:59.734 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:59.735 [debug] Setting environment variable VIRTUAL_ENV in collection to /home/gabe/.pyenv/versions/3.10.12/envs/yt
2024-02-08 20:05:59.735 [debug] Setting environment variable VIRTUAL_ENV_PROMPT in collection to (yt) 
2024-02-08 20:05:59.735 [debug] Prepending environment variable PS1 in collection with (yt) 
2024-02-08 20:05:59.735 [debug] Prepending environment variable PATH in collection with /home/gabe/.vscode-server/extensions/ms-python.python-2024.1.10391007/pythonFiles/deactivate/bash:/home/gabe/.pyenv/versions/3.10.12/envs/yt/bin:
2024-02-08 20:05:59.735 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:05:59.736 [info] Send text to terminal: /bin/python3 /home/gabe/.vscode-server/extensions/ms-python.python-2024.1.10391007/pythonFiles/printEnvVariablesToFile.py /home/gabe/.vscode-server/extensions/ms-python.python-2024.1.10391007/pythonFiles/deactivate/bash/envVars.txt
2024-02-08 20:05:59.746 [debug] Time taken to get env vars using terminal is 10ms
2024-02-08 20:06:01.213 [debug] Clearing context for python dependencies not installed: /mnt/f/dev/hms-kaggle/eeg/train.py
2024-02-08 20:06:03.921 [debug] Terminal shell path '/bin/bash' identified as shell 'bash'
2024-02-08 20:06:03.921 [debug] Shell identified as bash 
2024-02-08 20:06:03.922 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:06:04.621 [debug] Clearing context for python dependencies not installed: ms-python.python.Python
2024-02-08 20:06:04.621 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python
2024-02-08 20:06:04.622 [debug] Found cached env for /home/gabe/.pyenv/versions/3.10.12/envs/yt/bin/python

I also found a workaround for this issue that I'm ok with, I set "python.terminal.activateEnvironment": false in the settings. It means that when I open up a terminal I have to activate the env I want to use myself, but otherwise it works fine.

@karrtikr
Copy link
Author

karrtikr commented Feb 9, 2024

Previously, when I selected a venv, for example yt, in the bottom right corner, and then when I would open up a new terminal, it would activate this venv for me and the PS1 would be correct.

Can you send a screenshot of how it looks in that case? Because it's a virtual environment, I expect the name of the virtual environment (yt) to be added in the prompt.

@karrtikr
Copy link
Author

karrtikr commented Feb 9, 2024

I see what it is, thanks for sharing your .bashrc. You've specified:

export PYENV_VIRTUALENV_DISABLE_PROMPT=1

which disables the prompt particularly for pyenv. If you notice in the logs, we use "~/.pyenv/versions/3.10.12/envs/yt/bin/activate" to activate pyenv instead of "pyenv activate yt", hence that variable is not respected. Can you add the following to your .bashrc?

export VIRTUAL_ENV_DISABLE_PROMPT=1

@karrtikr
Copy link
Author

karrtikr commented Feb 9, 2024

If that doesn't work, please add VIRTUAL_ENV_DISABLE_PROMPT to 1 in your systems variable: https://askubuntu.com/a/58828. That'll surely make VS Code pick it up.

This won't be needed once #22128 is fixed.

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Feb 9, 2024
@gabethehuman
Copy link

It seems to work, thanks, I think the issue can be closed but I'll leave it to you to decide :)

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Feb 9, 2024
@karrtikr
Copy link
Author

Great, thanks. Did adding that line to bashrc suffice or did you have to add it as systems variable?

@gabethehuman
Copy link

For me bashrc worked :)

@karrtikr
Copy link
Author

Okay cool. I'll keep an eye on how many users run into this, depending on which we can explore using "pyenv activate" commands instead, closing this issue for now.

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Feb 11, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
experimenting Feature is part of an experiment triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants