Skip to content

[Solved] CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your shell, run...

Last Updated on 2022-08-03 by Clay

Problem

Today I use Anaconda to activate the python virtual environment, but I got the following error message and cannot enter the virtual environment.

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - 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'.

Solution

The error is occurred because the last time we use conda activate <ENVIRONMENT> to activate the environment, and we did not use conda deactivate to exit the environment.

But if we use the conda init <SHELL_NAME> the error message said, we need to restart our terminal.

In fact, I think there is a faster solution: we can use source activate to enter the activated environment again. If the environment is you want to use, you can start to work; If not, we can use conda deactivate to exit.

Then, you can use conda activate <ENVIRONMENT> to activate any environment you want.

By the way, if you forget the names of your environments, you can use conda env list to check your environment names.


References


Read More

1 thought on “[Solved] CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your shell, run...”

  1. Pingback: CommandNotFoundError: Your shell has not been properly configured to use 'conda activate' - 我有点酷

Leave a Reply