Why is conda being called when I open up a terminal?
Asked Answered
G

2

9

I'm using Kubuntu and have installed anaconda. When I open up Konsole (the terminal), there's a slight pause before I get the command line. The slight pause is being caused by a conda process running (looking at the output of the top command). I installed the latest version of anaconda and then have used a 3.6 python environment by

conda install python=3.6

(I use tensorflow which doesn't use 3.7 yet)

I have previously used older versions of anaconda to get version 3.6 and haven't seen this problem. This time however I tried to do it the recommended way as shown above.

Why does conda run when starting up a terminal, what is it doing, and how can I stop it?

EDIT: whats been added to my bashrc file

# added by Anaconda3 5.3.1 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/home/alex/anaconda3/bin/conda' shell.bash hook 2> /dev/null)" if [
$? -eq 0 ]; then
    \eval "$__conda_setup" else
if [ -f "/home/alex/anaconda3/etc/profile.d/conda.sh" ]; then
    . "/home/alex/anaconda3/etc/profile.d/conda.sh"
    CONDA_CHANGEPS1=false conda activate base
else
    \export PATH="/home/alex/anaconda3/bin:$PATH"
    fi 
fi 
unset __conda_setup
# <<< conda init <<<

I don't see anything there that would be called every time I open up a terminal.

Germiston answered 17/12, 2018 at 9:26 Comment(8)
conda maintains the Python environment, if you install anaconda you will have conda command with this you can maintain environment for multiple versions of PythonEmmert
Check your ~/.bashrc file for conda related linesRobrobaina
Thanks for your reply. All I'm doing is opening up a command window. Why is conda being called? I get if I use conda or python in the terminal window then I get that it would be called.Germiston
@Chris. I have code added to by bashrc file by anaconda, but it looks that it only changes the python path (so anaconda gets called rather than the default kubuntu 2.7). conda.sh in profile.d is referenced. I don't see any connection to the terminal,Germiston
You should add those lines to your question, but my guess is, if you try hashing those lines out (add a '#' to the line starts to ignore them) in the .bashrc, then try opening a new terminal, it might work as you wantRobrobaina
@Chris, I commented out all the additional anaconda lines apart from the line "export PATH ...." (then sourced the file) and things seem to be working as I would expect, i.e. conda isn't getting called every time the terminal is being opened and the expected python version is being called. I can also do "conda --version" and get the version returned. Anybody know if there's a problem doing that?Germiston
Regarding "I don't see anything there that would be called every time I open up a terminal." ... the bashrc file is run each time you open a terminal because that file's job is to prepare the shell/env for your use. So it should not come as a surprise that adding scripts there might slow down the initialization of a terminal instance.Shellans
@meissner. That makes sense. I thought the bashrc file was only called when logging in or when calling source on the file.Germiston
G
27

This can be solved by typing:

$ conda config --set auto_activate_base false

Another way you can do this is by opening your ~/.condarc file and manipulating it yourself.

$ open ~/.condarc

Replace auto_activate_base: true with auto_activate_base: false
If its not found add this line: auto_activate_base: false

You can reverse this by typing: $ conda config --set auto_activate_base true

Gothic answered 11/12, 2019 at 11:55 Comment(3)
Thanks for you answer, I hope others find it useful. I stopped using Anaconda due to this issue, preferring now to set things up myself.Germiston
Man, conda is annoying. It's like the Apple of the python world. Once you install it, it tries to own you.Wetmore
@Wetmore OMG XDDD I'm going to steal that phrase xDTanto
Y
4

Simply run:

conda config --set changeps1 False

You can also edit your ~/.bashrc

vi ~/.bashrc
Your answered 12/3, 2019 at 0:19 Comment(1)
Thank you! This just solved so many of my issues at once. Anaconda was running everytime I opened up terminal. This stopped that and made it so even when I do activate anaconda there isn't the annoying (base) prefix.Jarboe

© 2022 - 2024 — McMap. All rights reserved.