0

So, recently I started to learn Python for Data Sc. and installed miniconda. I planned to use VS Code for practice. I added python.exe path to VS Code. But when I started executing python programs in my default Git Bash terminal from VSCode, it gave the following error:

$ conda activate base

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.

To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - cmd.exe
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

In the Git Bash Terminal, I cannot even activate the base virtual environment. Although I careted another environment named "xyz" but I am not able to switch to it either.

Help me with the error, with my default preferences(VSCode & Git Bash).

saint_sharan
  • 119
  • 1
  • 12
  • There are several questions asking the same or similar things: https://stackoverflow.com/questions/56438511/vscode-conda-activate-base-giving-commandnotfounderror https://stackoverflow.com/questions/47246350/conda-activate-not-working https://stackoverflow.com/questions/43351596/activating-anaconda-environment-in-vscode Do any of these fix it for you? – Svit Jan 15 '21 at 18:18
  • 1
    @saint_sharan -How are things going? Just checking in to see if the information provided was helpful. – Jill Cheng Feb 04 '21 at 08:12
  • @jill-cheng your solution worked. Thanks for that. But it is working, aren't the source deactivate and conda deactivate the same? Also, source conda is depreciated – saint_sharan Feb 04 '21 at 08:16

1 Answers1

1

I activated the conda environment in the bash terminal with the following command:

  1. Use the command "source deactivate",
  2. Then use the command "conda deactivate",
  3. Now we can use the command "conda activate base" to activate the conda environment:

enter image description here

Jill Cheng
  • 9,179
  • 1
  • 20
  • 25
  • can you tell me what is happening actually after typing these commands? Also, source deactivate and conda deactivate, aren't they same? – saint_sharan Feb 04 '21 at 08:13
  • @saint_sharan -These two commands are to exit the current environment. I found that using "source deactivate" and then using "conda activate base" also worked. When I used "conda deactivate" to exit the current environment, it did not work, but "source deactivate" worked. – Jill Cheng Feb 04 '21 at 08:38