Troubleshoot: Conda CommandNotFoundError on Mac
Posted on Jul 16, 2018 in Troubleshoot • 11 min read
Troubleshoot: Conda CommandNotFoundError on Mac¶
Conda commands worked just fine after I installed it. However, one day when I was trying to call conda activate pelican
like I always did to update this blog, the following error message popped up.
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If your shell is Bash or a Bourne variant, enable conda for the current user with
$ echo ". /Users/YOU/anaconda3/etc/profile.d/conda.sh" >> ~/.bash_profile
or, for all users, enable conda with
$ sudo ln -s /Users/YOU/anaconda3/etc/profile.d/conda.sh /etc/profile.d/conda.sh
The options above will permanently enable the 'conda' command, but they do NOT
put conda's base (root) environment on PATH. To do so, run
$ conda activate
in your terminal, or to put the base environment on PATH permanently, run
$ echo "conda activate" >> ~/.bash_profile
Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
your ~/.bash_profile file. You should manually remove the line that looks like
export PATH="/Users/YOU/anaconda3/bin:$PATH"
^^^ The above line should NO LONGER be in your ~/.bash_profile file! ^^^
Since the instructions seemed fairly straightforward, I followed them but to no avail. After consulting friends and the internet, the following solution worked just fine.
cd
to home directory andopen .zshrc
- manually remove
export PATH=~/anaconda3/bin:$PATH
from your.zshrc
file - add this line
. /Users/ROOT_USER_HERE/anaconda3/etc/profile.d/conda.sh
to your.zshrc
file - run this
$ echo ". /Users/YOU/anaconda3/etc/profile.d/conda.sh" >> ~/.zshrc
Et voilà! conda activate <envname>
works perfectly now.
NOTE¶
source activate <envname>
andsource deactivate
no longer works now- Use only
conda activate <envname>
andconda deactivate