Closed
Description
Refs: #21793
- windows @eleanorjboyd
- linux @lramos15
- macOS @aiday-mar
Complexity: 5
Requirements
Similar to #21102 hence preassigning.
- Python extension pre-release
- Latest VSCode Insiders
- Ability to create virtual environment
- Use
python -m venv <name>
to create virtual envs.
- Use
- Ability to create conda environment
- Install conda via: https://conda.io/projects/conda/en/latest/user-guide/install/index.html. Make sure it's on
PATH
during installation. - Run
conda init --all
& restart the shell. - Create conda env using
conda create -n <name> python -y
.
- Install conda via: https://conda.io/projects/conda/en/latest/user-guide/install/index.html. Make sure it's on
- Basic terminal shell types, please tick whatever is available in your OS:
- Windows:
- cmd
- powershell
- powershellcore
- Linux:
- bash
- zsh
- fish
- macOS :
- bash
- zsh
- Windows:
- Nice to have:
- sh
- ksh
- csh
- tcsh
- nushell
- xonsh
Verification
- Add following to user settings and reload window:
"python.experiments.optInto": ["pythonTerminalEnvVarActivation"]
-
Run
conda config --set auto_activate_base True
. -
Open a workspace folder and activate Python extension by opening a Python file.
-
Select a virtual environment using
Python: Select Interpreter
command. -
Loop -> Do the following for all terminal shell types:
- Open a new terminal.
- Ensure we indicate the env is activated in at least one of the following ways:
- Terminal prompt carrying selected environment's name is present (please ignore if you see
(base)
: Active venv is activated in terminal but terminal indicates that(base)
is activated #21887):
- Notification appears, simply close it for now:
- Terminal prompt carrying selected environment's name is present (please ignore if you see
- Make sure terminal is activated using the selected environment. Run the following in terminal:
python -c"import sys;print(sys.executable)"
- Output should contain the path to interpreter selected. For eg. for
.venv
created viapython -m venv .venv
it looks something like:C:\Users\karraj\OneDrive - Microsoft\Desktop\folders\crap\.venv\Scripts\python.exe
- Change the default shell in your OS using
Terminal: Select Default Profile
, saybash
->fish
-
Select a conda environment using
Python: Select Interpreter
command and repeat the above loop. -
If the notification was visible at some point:
- Verify clicking "learn more" opens this wiki.
- Verify that opening a new terminal after clicking "Don't show again" does not show the notification.