When launching a new terminal the conda init script takes 2-3 seconds to run...
I am running a fresh install of Anaconda3 5.3.0 on Ubuntu 18.04
Not sure if this is a bug or not, a fix or workaround would be appreciated.
The responsible code from my .bashrc script:
# added by Anaconda3 5.3.0 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/home/matiashh/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/home/matiashh/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/matiashh/anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/home/matiashh/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
Duplicate of https://github.com/ContinuumIO/anaconda-issues/issues/10173 - please see discussion there. Closing to consolidate discussion.
A TL;DR as this is currently the first hit on Google: the problem is that the NotImplementedError()
raised in conda/activate.py
takes a long time to pop up in some configurations. The quick-fix is to comment out the line that sets __conda_setup
and forcing the if statement to fail immediately (replace $? -eq 0
with 1 -eq 0
or just replace the whole thing with what's in the else block). This bypasses the whole thing and uses the fall-back method of setting up your environment (which takes almost no time at all).
An alternative is to disable auto activation with:
conda config --set auto_activate_base false
Most helpful comment
An alternative is to disable auto activation with:
conda config --set auto_activate_base false