Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 605
LucG Avatar asked Nov 07 '25 09:11

LucG


2 Answers

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.
like image 75
Sidon Avatar answered Nov 09 '25 22:11

Sidon


Or you can also just use conda deactivate. For a regular python environment, deactivate or source deactivate should work, but if you try that, you get a hint to use conda deactivate instead.

(base) mooreb@ubtest2:~$ deactivate
DeprecationWarning: 'source deactivate' is deprecated. Use 'conda deactivate'.
(base) mooreb@ubtest2:~$ conda deactivate
mooreb@ubtest2:~$
like image 29
briangmoore Avatar answered Nov 09 '25 23:11

briangmoore



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!