66

My anaconda command prompt now says:

(base) C:\users\user_name>

I would like to know why (base) appears in front of the prompt. This started appearing since I created a virtual environment to run Django. If I enter 'deactivate' the prompt disappears but if I close the terminal and open a new terminal the 'base' is back again.

(base) C:\users\user_name> deactivate
C:\users\user_name>

The trouble is that this prompt does not recognize pip or any anaconda commands. I can run pip on the 'base' prompt, but not on the original one. I installed a module in '(base)...' using pip but this module is recognized by my ide.

conda list anaconda

in '(base)..' gives th version of Anaconda as 4.4. without the base, it does not recognize conda. I have run pip and conda several times before this happened. I'm running Windows 10.

vineeth venugopal
  • 1,064
  • 1
  • 9
  • 17
  • 2
    You've made a second environment. Anaconda cmd is telling you which virtual environment it's looking at when you execute commands. I'm not sure what the issue is? Why would you `deactivate` so that it isn't pointing to either of your environments? Before making a custom environment, there is no need to tell you it's looking at the default `Base` – roganjosh Jul 25 '18 at 19:52
  • @roganjosh I don't have any custom environments, and it still says `(base)`. – gargoylebident May 15 '21 at 23:38

10 Answers10

84

Try this:

conda config --set auto_activate_base false

The changeps1 only hide the command prompt, you still in this environment.

auto_activate_base can avoid entering the environment.

Woko
  • 1,521
  • 12
  • 16
30

Although Blockchain Business's answer is correct, as of v 4.6.4

DeprecationWarning: 'source deactivate' is deprecated. Use 'conda deactivate'.

so,

conda deactivate

This actually deactivates Anaconda completely, so may not be the best solution...

To restore:

 conda activate
B Seven
  • 44,484
  • 66
  • 240
  • 385
19

Change command prompt (changeps1) in ~/.condarc:

changeps1: False

Reference:

how to modify conda 'source activate' ps1 behavior

Document:

https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#change-command-prompt-changeps1

geisterfurz007
  • 5,292
  • 5
  • 33
  • 54
张玉锋
  • 191
  • 1
  • 2
12

"(base)" is displayed to tell you which environment you are in. "base" is the default environment.

You can create a new environment from within Anaconda Navigator. You might do this to run a different version of python, perhaps, for example, because a library you wish to use is only compatible with python 3.6 or lower.

Also if you want to install an experimental library/package and not have it break your other installed packages, you might install it in a new environment, where it is isolated from the rest of your installed libraries/packages.

You are probably best to use the Environments tab in Anaconda Navigator for the creation, management of environments and installation of libraries/packages, but you can use the Anaconda Prompt commands if you like and on some machines it is a lot faster to do so.

Be aware that although pip install and conda install commands are supposed to play better together these days, I would still recommend sticking to conda install and only using pip if conda install won’t work for a particular package. This is because installing python packages so they do not conflict with one another is apparently not so trivial - and using two different package managers could be a problem. In the old days pip was almost certain to break environments that had been set up with conda or Anaconda Navigator.

Benice
  • 409
  • 3
  • 15
9

If you face the issue in Ubuntu you can try the below two steps to remove it from your command prompt.

  1. conda config
  2. conda config --set changeps1 False
rene
  • 41,474
  • 78
  • 114
  • 152
Wasim
  • 149
  • 1
  • 3
6

I had the same issue, I typed the following command to remove the (base) reference:

source deactivate

1

In my case, I had run source ~/anaconda3/etc/profile.d/conda.sh and expected the env to get activate.

Instead it must be conda activate

SuperNova
  • 25,512
  • 7
  • 93
  • 64
1

type 'conda deactivate' in the working terminal.

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 22 '22 at 09:17
0

It sounds like when you installed Anaconda, it's now seeing that as your default environment, and with Anaconda it's best that you install packages using conda rather than by using pip, because at best pip installed packages won't be recognized by Anaconda, and at worst the pip installed packages can break your Anaconda install. I went through some of this before myself, as I needed to use Anaconda for a Python course I was taking, however I use Kubuntu, so I don't have a lot of knowledge around using it on Windows.

For more info on using Anaconda, see https://conda.io/docs/user-guide/getting-started.html You can probably use Anaconda Navigator to create virtual environments and install packages too.

zalloy
  • 17
  • 3
  • Why wouldn't anaconda command prompt see Anaconda? This is different to a normal command prompt in Windows – roganjosh Jul 25 '18 at 19:51
  • Perhaps Anaconda isn't added to the system path, so it isn't seeing that set of commands. See https://medium.com/@GalarnykMichael/install-python-on-windows-anaconda-c63c7c3d1444 – zalloy Jul 25 '18 at 19:54
  • That's not the point I'm making. Anaconda comes with its own command prompt on Windows. Would it be logical if, when opening _anaconda_ command prompt, it looked at the system installation, regardless of whether or not that was Anaconda? – roganjosh Jul 25 '18 at 19:55
  • Yes, that would be logical. However, if you just open the command prompt by using `cmd` you're going to get the default _Windows_ system prompt, which is the _system_ environment, and not that provided by _Anaconda_ or `venv` or whatever one might use to manage virtual environments or additional functionality. It still respects the system's $PATH variable – zalloy Jul 25 '18 at 20:00
  • mmm, I think we're coming from different angles here :) I left a comment under the main question, does that clarify my point to you? Your last comment is contradictory in terms of how I wanted to phrase my question so maybe I was unclear; in one sentence you're saying that it would be logical, and in the next you go on to say that it wouldn't be logical to show the _system_ environment. So, if you have 2 `venvs` in Anaconda, why shouldn't the default environment be `Base`? – roganjosh Jul 25 '18 at 20:06
  • In other words, if you never had Python installed on a system and installed Anaconda, it becomes everything (the system Python as well as the main Anaconda environment) but everything that is installed is considered part of the "base" venv. It's only when you make a second environment that there's any need for anaconda cmd to make a distinction, and I think it's logical that it should pick the base env when you open it. At least, that's my understanding. – roganjosh Jul 25 '18 at 20:10
  • Right, what you're saying makes sense and is logical. However, if OP installed Anaconda and _didn't_ tell the installer to add it to their system path, then they would need to go to the directory they installed Anaconda to and invoke it from there in order for it to work. Otherwise, they're going to get a `command not found` sort of error – zalloy Jul 25 '18 at 20:55
  • I again point out that this is a recent problem and I have been using Anaconda since last year. – vineeth venugopal Jul 26 '18 at 08:46
-1

Showing the active environment in front of the path like (base) C:\users\user_name> is a feature, not a bug. If you pip-install a module into the base environment (bad practice warning: Use conda install this_module -c conda-forge or pip install this_module into a separate environment), you'll first need to activate the base environment before you can actually use this_module. If you don't know how to do this in your IDE (although this a base functionallity of any IDE), open a cmd shell, type conda activate and then start your IDE directly from the (base) C:\users\user_name> prompt.

Peter
  • 10,959
  • 2
  • 30
  • 47