8

I have been using conda for a few months. The following is the version that I'm using:

conda -V
conda 4.5.4

Previously, to activate or to deactivate the conda environment, I think I have used the following command:

source activate [env_name]
source deactivate

However, recently, the above commands don't work on my machine for unknown reason. The following is the result:

bash: activate: No such file or directory

More strangely, the following commands work:

conda activate [env_name]
conda deactivate

Could you suggest what might have happened and how to fix this problem?

3 Answers 3

6

The problem may be because the Anaconda directory is not part of your PATH. You can check this by entering the following command in your terminal. If you don't see the Anaconda directory(Looks something like this /home/user/anaconda3/bin), you found your issue!

echo $PATH

To fix this problem, you can simply enter the following command in the terminal where user is your username.

export PATH="/home/user/anaconda3/bin:$PATH"

If this helped, please mark this as an accepted answer so that your original question can be marked as solved!

1
  • 1
    this needs to be accepted as the answer for this Feb 18, 2022 at 13:33
5

This behavior is since 4.4 version. Take a look at this page.

Conda 4.4 introduced new scripts that make activation behavior uniform across operating systems. Where you once had “source activate envname” on unix, and just “activate envname” on windows, Conda 4.4 allowed “conda activate envname”.

You can read more on 4.4 changes here

1

You can try this commands to resolve:

  • conda activate then

  • source activate [env name]


After finishing your task, you can deactivate the environment by :

conda deactivate

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .