Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In conda, what is the differece between "base" environment and no environment at all?

The title says it. I installed conda and now all my terminals open in the base environment, "(base)" at the start of my prompts. If I type "conda deactivate" it drops out of base to someplace else, like no environment. How is this different from base?

(This question is a tangent from my other, asking if the expected workflow is for me to stay in base: With conda/anaconda should I work in (base) all the time?)

like image 458
Mastiff Avatar asked Mar 13 '19 04:03

Mastiff


People also ask

What is a base environment in conda?

Conda allows you to create separate environments containing files, packages and their dependencies that will not interact with other environments. When you begin using conda, you already have a default environment named base. You don't want to put programs into your base environment, though.

What does the conda activate base setting do?

This setting controls whether or not conda activates your base environment when it first starts up. You'll have the conda command available either way, but without activating the environment, none of the other programs in the environment will be available until the environment is activated with conda activate base.

How do I preserve and move an environment in conda?

Conda provides a number of ways to preserve and move environments. On installation, conda creates a base environment. However, you can also create your own base environment with packages you frequently use. The - -clone option will create a clone (or snapshot) of the environment,

What is the difference between Conda and Conda-pack?

Conda will use a spec list to download the exact packages in an environment. Alternatively, conda-pack archives an entire environment including the package binaries, which is useful in low or no bandwidth situations. Exporting an environment using conda is ideal for recreating environments across different platforms and operating systems.


3 Answers

activating a conda environment is not much more than applying settings to your shell to use a specific python interpreter (and the modules and libs associated to that interpreter)

when you drop out of a conda environment, your shell reverts to the python interpreter determined by your $PATH environment variable -- generally speaking, this default is typically a non-conda environment and is usually the default python installed with the OS (if applicable)

As freude is saying, the obvious way to see this in action is to do which python as you activate/deactivate environments

like image 192
booleys1012 Avatar answered Oct 19 '22 04:10

booleys1012


When playing with python virtual environments in linux (and macOS), it is useful to use the command which python or which pip from the terminal. This command shows the path to the currently used python interpreter - that is the thing, together with the location of site packages, that differs one environment from another. The python environment is nothing else but a directory where you have a copy of your python interpreter and installed libraries. Switching from the (base) to the deactivated (base) implies switching from one python interpreter to another one - that may be checked using which.

In windows, the closest equivalent of which is where.

like image 7
freude Avatar answered Oct 19 '22 04:10

freude


Short answer: convenience. When base is activated: check out /anaconda3/bin/ you'll find all the binaries that will be included in the $PATH environment variable (try echo $PATH in your bash shell)

When base is NOT activated: basically you only have conda binary available to use by default. Once again, try echo $PATH in your bash shell to see the difference.

like image 4
Long Avatar answered Oct 19 '22 03:10

Long