Search code examples
anacondaminiconda

Cannot activate Conda environment


I installed miniconda and I created an environment:

conda create --prefix /path/to/a/directory/Python36 python=3.6

Then I tried to active it:

conda activate /path/to/a/directory/Python36

But I got this error message:

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

But when I run condo init --all, I nothing changes, everything is already initialized.

...
No action taken.

What am I missing?


Solution

  • Usually you activate an environment by name:

    > activate myenv
    

    Mac/Linux users have > source activate. Newer conda versions may use > conda activate.

    In your case, what is the name of your environment? You can list existing environments:

    > conda env list
    

    If you find an env other than root or base, activate it as mentioned above.

    In the future, consider creating environments with a name to easily access later:

    > conda create -n myenv ... python=3.6
    > activate myenv
    

    Note: ... indicates arbitrary optional flags.