Last updated: Apr 10, 2024
Reading time·4 min
base
environmentbase
environment but hide the (base) command line promptbase
Anaconda environmentWhen you open your terminal after installing Anaconda, you will see that that
base
environment is automatically activated.
If you don't want to enter the base environment when opening your terminal set
the auto_activate_base
config option to false
.
You can issue the following command if you don't want to enter the Anaconda
base
environment every time you open your terminal.
conda config --set auto_activate_base false
If you open a new terminal session, you'll see that the base
environment is
not activated automatically.
If at any point in time, you want to revert the change, set the base
environment to be activated automatically by setting auto_activate_base
to
true
.
conda config --set auto_activate_base true
If you run the command, the next time you open your terminal, it will
automatically activate the Anaconda base
environment.
Note that
you can't delete the Anaconda base
environment.
base
is the default Anaconda environment and cannot be deleted.
base
environmentIf you simply need to disable the Anaconda base
environment, use the
conda deactivate
command.
conda deactivate
If you need to activate the base
environment, use the conda activate
command.
conda activate
base
environment but hide the (base) command line promptWhen the auto_activate_base
setting is set to false
, opening a new terminal
session doesn't automatically start the base
Anaconda environment.
conda config --set auto_activate_base false
However, there is also a setting that allows you to start the base
environment
without modifying your terminal prompt.
conda config --set changeps1 false
When the changeps1
setting is set to false
, the next time you open your
terminal, you won't see the (base)
environment message even though the
environment is active.
The setting basically disables showing the active Anaconda environment.
If you need to re-enable showing the active environment, set changeps1
to
true
.
conda config --set changeps1 true
When the prompt modifier is disabled, you might get confused about which Anaconda environment is currently active.
You can issue the conda info --envs
command to check the currently active
Anaconda environment.
conda info --envs
The command shows an asterisk *
next to the currently active Anaconda
environment.
base
Anaconda environmentThe base
environment is the default Anaconda environment.
As with all other environments, it is used to install packages in isolation.
If you need to get a better understanding of how environments work, open the Anaconda Navigator.
For example, on Linux or macOS, you can issue the following command from your terminal.
anaconda-navigator
On Windows, you can search for Anaconda Navigator and start the application.
Once you open the Anaconda Navigator, click on the Environments tab.
The Anaconda environments are shown right below the Search Environments input field.
You can create a new environment by clicking on the Create button at the bottom.
You can activate an environment by clicking on it. The active environment has a green left border and a run button.
To install a package after you've selected the environment:
Select to filter by All or Not installed packages.
Type the name of the package in the search field.
Click on the check box next to the package's name.
Click on the Apply button.
The package will only be installed in the currently active virtual environment.
This limits the scope of security vulnerabilities and enables you to install different versions of the same package on the same machine without breaking your dependencies.
If you need to activate your new environment using the command line, issue the
conda activate <your-env>
command.
conda activate <your-env>
Make sure to replace the placeholder with the actual name of your virtual environment.
As previously noted you can use one of the following commands to list the available virtual environments.
conda info --envs # Or conda env list
The currently active environment will have an asterisk *
next to its path.
Make sure you
don't try to delete the base
Anaconda environment
as this is not allowed.
You can learn more about the related topics by checking out the following tutorials: