Reputation: 1948
I recently installed Anconda Python on my Linux Mint 19.0 desktop. Actually, I had it installed before and everything worked great, same as with my Mint 19.0 laptop. However, I recently had to wipe my desktop and reinstall everything. Now, whenever I open the Terminal program, the prompt takes several seconds to appear. I've added set -x, set +x to the beginning and end of my bash profile to diagnose where the slowdown is.
The terminal load hangs on this line:
/home/auerilas/anaconda3/bin/conda shell.bash hook
for a few seconds. It's never done this before and doesn't do it on my other computer. Any thoughts on why this is happening? It's not a deal-breaker, but it is annoying.
Upvotes: 29
Views: 13587
Reputation: 261
try making default loading of anaconda to False.
conda config --set auto_activate_base false
this loads path for conda only when you run the command conda activate
Upvotes: 26
Reputation: 21
I wrote a simple script that wraps commands related to conda so that conda will only be sourced when you use these commands for the first time, and there's no need to activate conda by hand. This makes my terminal launch like 20 times faster. I use fish by the way, but I'm pretty sure that you can do the same in bash.
function conda-init -d "initialize conda shell functions"
if type conda | grep -q alias
echo "initializing conda..."
eval /Users/madmax/opt/anaconda3/bin/conda "shell.fish" hook $argv | source
end
end
function python3 -d python3
conda-init
functions -e python3
python3 $argv
end
function py -d python3
conda-init
functions -e py
alias py python3
python3 $argv
end
function ipy -d ipython
conda-init
functions -e ipy
ipython $argv
alias ipy ipython
end
alias conda "conda-init; conda"
Upvotes: 2
Reputation: 386
I had the same problem and I solved it by recovering my old .bashrc file then I can load the bash configuration file of Anaconda whenever I need it.
To achieve this , follow these steps
cd ~
mv .bashrc conda.bashrc
mv .bashrc-anaconda3.bak .bashrc
gedit .bashrc
alias anaconda='source ~/.conda.bashrc'
source .bashrc
anaconda
Upvotes: 24
Reputation: 21
In my case, caused by Conda as well. I fixed it by commenting out part of ~/.bashrc
Remove/comment this out:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
#__conda_setup="$('/mnt/hdd/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
#if [ $? -eq 0 ]; then
# eval "$__conda_setup"
#else
# if [ -f "/mnt/hdd/anaconda3/etc/profile.d/conda.sh" ]; then
# . "/mnt/hdd/anaconda3/etc/profile.d/conda.sh"
# else
# export PATH="/mnt/hdd/anaconda3/bin:$PATH"
# fi
#fi
#unset __conda_setup
# <<< conda initialize <<<
Directory might be different depending on where you installed it.
Upvotes: 2
Reputation: 2262
An alternative approach, which doesn't involve removing Anaconda, is just to update to a more recent version of Anaconda. This can be done from Anaconda Navigator, and bash startup was greatly improved for me.
Upvotes: 2