How to stop Conda from activating the base environment by default
Codemia Knowledge Hub ·
Run conda config --set auto_activate_base false. New shell sessions then start with a clean prompt and no environment active until you activate one yourself. This is the official way to turn off automatic activation of base.
The one-line fix
Open a new terminal to see the change. The prompt no longer starts with (base).
Verify the setting
Expected output:
If it still shows True, a system-level config may be overriding yours (see where the setting is stored).
What the setting changes
conda init adds a hook to your shell startup file (.bashrc, .zshrc, etc.). Every new terminal runs that hook, which does two things:
- Makes
condacommands available in the shell - Activates the
baseenvironment
auto_activate_base false disables only step 2. Conda commands still work; you just don't start inside an environment.
Before (default):
After:
Activate environments when you need them:
Where the setting is stored
The setting lives in ~/.condarc, a YAML file in your home directory:
You can edit this file directly. conda config just writes to it for you.
When the setting seems to be ignored
Conda reads several config files. To see which ones and in what priority order:
A system-level file such as /etc/conda/.condarc, or an environment-level one, can override your user setting:
Here the system config wins. Changing it needs admin access, but you can override it with an environment variable:
Put that line in .bashrc or .zshrc to make it permanent.
Reverting to the default
To activate base on startup again:
Or remove the key from ~/.condarc:
Removing the key returns to Conda's built-in default, true.
What conda init adds to your shell profile
For Bash, conda init adds a block like this to ~/.bashrc:
This block makes conda commands available, and it also checks auto_activate_base and activates base when the setting is true. Do not delete or comment out the block to stop base activation. That removes all of Conda's shell integration, and conda activate stops working.
conda init vs auto_activate_base
conda init | auto_activate_base | |
| Purpose | Wire Conda into your shell | Control startup environment |
| Without it | conda activate does not work | base is always active |
| Command | conda init bash (or zsh, fish, etc.) | conda config --set auto_activate_base false |
| Modifies | Shell startup file (.bashrc, .zshrc) | ~/.condarc |
If conda is not found in a new terminal, the problem is conda init, not auto_activate_base. Run conda init for your shell first, then set the auto-activate preference. If you switch shells (for example from Bash to Zsh, or install Fish), run conda init zsh or conda init fish separately.
Activating an environment per project instead
Many developers want no environment on startup but automatic activation inside a project directory.
Using direnv
Entering the directory activates the environment, and leaving it deactivates it.
Using an environment-level .condarc
Conda does not read a .condarc from an arbitrary project directory. It does read one from the active environment's root ($CONDA_PREFIX) and from the path in $CONDARC, so you can keep environment settings scoped there:
This does not auto-activate anything, but it keeps environment management scoped.
Things that trip people up
- The current terminal does not change. The setting affects new shell sessions only. Open a new terminal.
- System-level
.condarcoverrides. On shared or corporate machines an admin may have setauto_activate_base: true. Check withconda config --show-sources. pythonnow means system Python. With auto-activation off,pythonin a new terminal is the system interpreter, not a Conda one. Activate an environment first.
Miniforge and Mamba
The same setting works with Miniforge and Mamba:
All Conda-compatible tools share the ~/.condarc file.
Related reading
- How do I print an exception in Python?
- How do I print the full NumPy array, without truncation?
- How do I print the key-value pairs of a dictionary in python
- How do I print to console in pytest?
- How do I print to stderr in Python?
- How do I profile a Python script?
- How do I profile memory usage in Python?
- How do I properly assert that an exception gets raised in pytest?
System design interview problems on this topic
- Design a Web Crawler: solution and walkthrough
- Design a Task Scheduler: solution and walkthrough
- Design a URL Shortener (TinyURL): solution and walkthrough
- Design an API Rate Limiter: solution and walkthrough
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseNo course covers this one yet
Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.
Build my courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.