vineeth venugopal
vineeth venugopal

Reputation: 1098

Why does '(base)' appear in my anaconda command prompt?

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.

Upvotes: 71

Views: 126793

Answers (10)

Ashani Fonseka
Ashani Fonseka

Reputation: 21

Type conda deactivate in the working terminal.

Upvotes: 2

Benice
Benice

Reputation: 426

"(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.

Upvotes: 13

SuperNova
SuperNova

Reputation: 27486

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

Upvotes: 1

Peter
Peter

Reputation: 12375

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.

Upvotes: -1

Woko
Woko

Reputation: 1769

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.

Upvotes: 96

Wasim
Wasim

Reputation: 149

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

Upvotes: 9

B Seven
B Seven

Reputation: 45941

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

Upvotes: 32

Blockchain Business
Blockchain Business

Reputation: 171

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

source deactivate

Upvotes: 6

zalloy
zalloy

Reputation: 17

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.

Upvotes: 0

Related Questions