9. Welcome to your new home - VS Code

Questions and discussion for this lecture live here. Hit Reply below to ask a question.

Some people may find that “conda activate my_env” is not causing any effect.

If that is your case and you have a fresh installation of Anaconda and VS code, open a new terminal in VS code and

  1. Type “conda init” within the terminal and then hit Enter.
  2. Close the terminal and open a new one.

This is permanent, you only need to do it once and you will be able to use conda normally from within VS code.

1 Like

Thanks for that @paulorrcampos
S

The Terminal pane in VS Code is opening with the following message:

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.

When I run the suggested command, it asks for my user password. I enter the password, hit enter and it says “no changes made”.

It leaves me with the same command prompt as before which doesn’t match Sean’s prompt format in the video:

I see:
(base) Kipps-MacBook-Air:Test kipp$
instead of:
(base) kipp@Kipps-MacBook-Air test %

When I opened Terminal for the first time directly (instead of via VS Code), it showed me the same message. I ran the suggested command and it was successful, my command prompt is now matching the format of Sean’s. (I think this means it switched from bash to zsh)

I have since closed and reopened VS Code but I still get the message in the Terminal pane and the prompt is still the old (bash) one, apparently not using the zsh interactive shell.

I don’t know whether it will present any issues down the line but thinking better safe than sorry.

If you know how to get Terminal within VS Code to switch to zsh I would be grateful for any tips :smiling_face:

Hi,
To confirm which shell is being used in your integrated terminal, you can execute the following command in your terminal, echo $0. Hopefully you will get something along the lines of /bin/zsh returned. Can you do this and report back?

Hi @Sean, thank you for your reply, and for producing this course.

echo $0 returned /bin/bash but after clicking around some more I found this drop-down menu (screenshot attached) which allowed me to pick zsh. Curiously Visual Studio Code was already showing zsh as default in the drop-down, yet still loading bash. Since picking zsh in that drop-down, all new terminals panes within VSC are opening with zsh so looks like problem solved.

1 Like

Great stuff @ae012 - glad you’re back on track!
S

I had a problem with Windows/VSC Terminal defaulting to PowerShell and not recognising ‘conda’. The following steps let me switch to cmd.exe in VSC
Press Ctrl + Shift + P to show all commands.
Type terminal in the displayed text box to filter the list.
Select Terminal: Select Default Shell.
You will be prompted to Select your preferred terminal shell.
Select Command Prompt (cmd.exe)

conda then worked fine in the VSC terminal

Thanks for sharing @simonstoye :+1: