I am using the Remote Explorer extension in VSCode to access my university HPC, which is Linux. I have miniconda installed in my HPC directory. Whenver I access HPC through VSCode, I am automatically directed to a virtual environment named R4.3.2 which I created previously. However, such auto activation does not occur when I type win+R, cmd, then ssh @.
Here is my .bashrc file
# .bashrc
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Source global definitions
# User specific environment
export PATH="/storage/***Lab/***/bin":$PATH
export LD_LIBRARY_PATH="/storage/***Lab/sharedata/softwares/libevent_v2.1.12_d20210816/lib":$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="/storage/***Lab/***/sft/R-4.3.3/lib64/R/lib":$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="/home/***Lab/***/lib/local_imagemagick/sft/lib":$LD_LIBRARY_PATH
export PKG_CONFIG_PATH="/home/***Lab/***/lib/pkgconfig":"/storage/***Lab/***/sft/libtiff/lib/pkgconfig"
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:"/home/***Lab/***/lib/local_imagemagick/sft/lib/pkgconfig"
export R_LIBS="/storage/***Lab/***/sft/R-4.3.3/lib64/R/library"
# User specific aliases and functions
alias cdh="cd /storage/***Lab/***"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/***Lab/***/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/***Lab/***/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/***Lab/***/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/home/***Lab/***/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
Here is my .bash_profile:
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
Here is my .zshrc file:
#
# .zshrc is sourced in interactive shells.
# It should contain commands to set up aliases,
# functions, options, key bindings, etc.
#
autoload -U compinit
compinit
#allow tab completion in the middle of a word
setopt COMPLETE_IN_WORD
## keep background processes at full speed
#setopt NOBGNICE
## restart running processes on exit
#setopt HUP
## history
#setopt APPEND_HISTORY
## for sharing history between zsh processes
#setopt INC_APPEND_HISTORY
#setopt SHARE_HISTORY
## never ever beep ever
#setopt NO_BEEP
## automatically decide when to page a list of completions
#LISTMAX=0
## disable mail checking
#MAILCHECK=0
# autoload -U colors
#colors
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/***Lab/***/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/***Lab/***/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/***Lab/***/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/home/***Lab/***/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
I tried to add conda deactivate to .bashrc and .zshrc, but the virtual environment is still auto activated when I use VScode to access HPC.
Here is the setttings.json file for my vscode:
{
//###########################################################################
// Path
//###########################################################################
// Path to R in linux
"r.rpath.linux": "/storage/***Lab/***/sft/R-4.3.3/bin/R",
"r.rterm.linux": "/storage/***Lab/***/sft/R-4.3.3/bin/R",
// Path to Python
"[python]": {
"editor.formatOnType": true
},
"python.defaultInterpreterPath": "C:\\Users\\***\\AppData\\Local\\Programs\\Python\\Python311\\python.exe",
//###########################################################################
// Formatting
//###########################################################################
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
//"editor.wordWrap": "wordWrapColumn",
"editor.fontSize": 16,
"workbench.iconTheme": "vscode-icons",
"terminal.integrated.defaultProfile.windows": "Command Prompt", //Terminal default to cmd.
"r.bracketedPaste": true,
"r.sessionWatcher": true,
"[r]": {
"editor.defaultFormatter": "REditorSupport.r"
},
// Vertical ruler
"editor.rulers": [80],
"workbench.colorCustomizations": {
"editorRuler.foreground": "#5a626b"
},
// Not having to manually select platform during remote access.
// Idea from https://www.cnblogs.com/jhj117/p/14520060.html and
// https://code.visualstudio.com/docs/remote/ssh
"remote.SSH.remotePlatform": {
"1**.**.**.***" (IP address): "linux"
},
"terminal.integrated.enableMultiLinePasteWarning": false,
"r.plot.useHttpgd": true,
"vsicons.dontShowNewVersionMessage": true,
"update.mode": "manual"
}
I want to know why this auto activate of a particular non-base env occurs and why it only occurs when using vscode but not when accessing HPC through command prompt and ssh. How to disable such auto activation when using vscode?