Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anaconda Python causing slow terminal startup/prompt

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.

like image 700
Nate Avatar asked Oct 08 '18 16:10

Nate


3 Answers

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

  1. Rename your current .bashrc file to something like conda.bashrc by executing these commands in your terminal
cd ~
mv .bashrc conda.bashrc
mv .bashrc-anaconda3.bak .bashrc
  1. Now, you have to define a custom command in your .bashrc file so it can load Anaconda only when you need it, to do so first you need to open your .bashrc file in a text editor
gedit .bashrc
  1. Add the following lines to end of your .bashrc so it can load the other conda.bashrc file which contain anaconda package configurations
alias anaconda='source  ~/.conda.bashrc'
  1. save .bashrc with the above mentioned edits and type in your terminal window
source .bashrc
  1. now you can load anaconda by simply typing anaconda in your terminal window
anaconda
like image 50
Mohamad AlJasem Avatar answered Oct 10 '22 09:10

Mohamad AlJasem


try making default loading of anaconda to False.

conda config --set auto_activate_base false

this loads path for condo only when you run the command conda activate

like image 35
user13485165 Avatar answered Oct 10 '22 07:10

user13485165


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.

like image 2
dash2 Avatar answered Oct 10 '22 09:10

dash2