Running a project from the wrong Conda environment can make Python import packages from a different prefix than the one you prepared. Activating the environment changes the current shell so commands resolve the selected environment's executables and activation scripts before you run Python, pip, or Conda package commands.
conda activate accepts an environment name or a directory path. A named environment such as analytics resolves under Conda's environment directories, while a prefix environment is activated with its path, such as ./envs.
Activation is local to the terminal session. If the command is not recognized or asks for shell setup, initialize Conda for that shell and open a new terminal before retrying; adding Anaconda to PATH by itself does not run package activation scripts.
If conda activate returns a shell initialization error, initialize Conda for that shell and reopen the terminal.
Related: How to initialize Conda for a shell
$ conda activate analytics (analytics) $
Replace analytics with the environment name. For a prefix environment, use the path instead, such as conda activate ./envs.
$ conda info --envs # conda environments: # # * -> active # + -> frozen base /opt/conda analytics * /opt/conda/envs/analytics
The asterisk marks the active environment. Newer Conda output may also show a plus sign for frozen environments.
$ echo $CONDA_PREFIX /opt/conda/envs/analytics
The prefix should point to the selected environment, not to the base installation.
$ python -c "import sys; print(sys.executable)" /opt/conda/envs/analytics/bin/python
Package commands run after activation use the active environment unless you pass an explicit environment option such as --name or --prefix.