I'm trying to create a virtual environment using conda on Google Colaboratory. However, I can't activate with the following error.
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
There are two improvements I've tried. There are three improvements that I've tried. One is to add the following code to ~/.bashrc.
# >>> conda init >>>
__conda_setup="$(CONDA_REPORT_ERRORS=false '$HOME/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "$HOME/anaconda3/etc/profile.d/conda.sh" ]; then
. "$HOME/anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="$PATH:$HOME/anaconda3/bin"
fi
fi
unset __conda_setup
# <<< conda init <<<
# ~~~~~~~~~~~~
conda create --name XXXXXX python=3.6 -y
conda activate XXXXXX
# ~~~~~~~~~~~~
Secondly, I added the following code to ~/.bashrc
export PATH="$PYENV_ROOT/versions/anaconda3-2.5.0/bin/:$PATH"
Thirdly, I added the following code to ~/.bashrc
. /opt/anaconda3/etc/profile.d/conda.sh
conda activate base
If I try to activate each of them, I get the same error. If anyone understands, please share your wisdom.
Thanks