Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the purpose of the "base" (for best practices) in Anaconda?

Tags:

conda

anaconda

It says it's a default environment but "You don't want to put programs into your base environment, though"

So what exactly should I use it for? Do other environments I create inherit from the base?

like image 343
JobHunter69 Avatar asked Jun 08 '19 05:06

JobHunter69


People also ask

What is purpose of conda base environment?

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 is base environment in Anaconda?

Conda has a default environment called base that include a Python installation and some core system libraries and dependencies of Conda. It is a “best practice” to avoid installing additional packages into your base software environment.

What is conda activate base?

With conda, you can create, export, list, remove, and update environments that have different versions of Python and/or packages installed in them. Switching or moving between environments is called activating the environment. You can also share an environment file.

Is Anaconda base a virtual environment?

We have one virtual environment called base. When we install Miniconda or Anaconda, it creates a default environment called base. This is what we are seeing in the output. We will now learn three common ways of creating a virtual environment.


1 Answers

The base environment is where conda itself gets installed. It's best to use Miniconda, and install all the things you want into separate environments.

Other environments do not inherit packages from the base environment. BUT the bin/ directory of the base environment is in the search path for executables. So if you call conda from inside any of your environments (which usually don't have conda installed), the one from the base environment is used.

If you install other executables into the base environment, they can be called from your other environments. But you'll have a hell of a tough time to distinguish whether the things you can call are actually in your environment, or in the base environment.
Therefore, it's best to just have conda in the base environment. And maybe other generic tools, like git or make, if you install that kind of tool with conda. But packages that are imported by your Python/R/whatever code do not belong into the base environment.

Don't worry about disk space if you create multiple environments with the same packages. conda does a very good job with hard-linking the same packages into multiple environments to save space.

The full Anaconda installer puts a ton of stuff into the base environment. That might seem convenient at first, but when you start creating new environments, you'll run into the problem I mentioned. You can call stuff from your new environment although it isn't installed there. Using Miniconda avoids this, at the cost of having to create a new environment before actually being able to use stuff. However, there's an anaconda meta-package which you can install to get the "ton of stuff" with one command.

like image 197
Roland Weber Avatar answered Sep 20 '22 15:09

Roland Weber