Search code examples
pythonanacondacondaminiconda

Get out of root conda environment


Once I have installed miniconda, I am permanently inside the root miniconda environment eg:

luc@montblanc:~$ conda info --envs
# conda environments:
#
bunnies                  /home/luc/miniconda3/envs/bunnies
expose                   /home/luc/miniconda3/envs/expose
testano                  /home/luc/miniconda3/envs/testano
testcondaenv             /home/luc/miniconda3/envs/testcondaenv
root                  *  /home/luc/miniconda3

Which results on the use of this environment python3 executable:

luc@montblanc:~$ which python3
/home/luc/miniconda3/bin/python3

How can I get out of this root environment without actually uninstalling python. E.g. I want

luc@montblanc:~$ which python3
/usr/bin/python3

and refer to the miniconda distribution of python explicitly (using full path /home/luc/miniconda3/bin/python3) when I need it.

I don't want to achieve any final goal doing this, I just want to understand what is happening and how it works.


Solution

  • See your .bashrc file. Miniconda adds their paths and change the default, find this file and then change or add the path you want, or remove the anaconda/miniconda path.

    In your .bashrc (probably ~/.bashrc) you will see something like:

    # added by Miniconda3 4.3.14 installer
    export PATH="/path/to/miniconda3/bin:$PATH"
    

    Add your path after this line, change this path or, for temporarily, use export on command line.

    Obs.

    • After this, probably you will have to use miniconda call by full path.
    • Restart your session after changes in .bashrc.