Mark
Mark

Reputation: 639

How to use "conda update -n base conda" properly

I have two very simple questions regarding updating conda. I.e. when updating one of my environments with conda update --all, I get a warning

==> WARNING: A newer version of conda exists. <==
  current version: xyz1
  latest version: xyz2

Please update conda by running

    $ conda update -n base conda

My setup comprises a base environment and two actual work environments, say, (env1) and (env2). The latter two environments are kept up to date with conda update --all, issued within each of those environments. The base environment was only generated in the installation process of Anaconda.

Question 1: Should one run conda update -n base conda on the command line of the OS (linux) prior to activating any environment? Or should one activate a particular environment? Or is the environment out of which this command is issued irrelevant?

Question 2: After running conda update -n base conda from out of whatever environment, as determined by the answer to question 1, would a subsequent conda update --all issued within one of my two work environments (env1,2) install or update any additional stuff, only as a consequence of the previous conda update -n base conda?

(PS.: I find many questions on stackoverflow regarding conda update conda, but they don't seem to cover this one.)

Upvotes: 28

Views: 36801

Answers (5)

VeraKozya
VeraKozya

Reputation: 691

Was getting the same "newer version of conda exists" warning and the provided update command (conda update -n base conda) was not actually updating conda itself, looping me right back to the warning. The following worked:

conda update conda --all

Upvotes: 0

Alex W
Alex W

Reputation: 757

If you are very behind on conda version like I was, I found that it will not update no matter what. In this case, try:

conda install -n base -c defaults conda=23.3.1

(NOTE: install rather than update) Just fill in whatever version it is asking you to update to.

EDIT: following the comment by @merv, include 'conda>=VERSION' included quotes to make sure you update to any version past the one specified (ENV being the environment you want to upgrade, e.g. base, and VERSION being the version you want to install to):

conda install -n ENV 'conda>=VERSION'

Upvotes: 43

meljw
meljw

Reputation: 31

I tried everything, in the end what worked was using this to update miniconda https://docs.conda.io/projects/miniconda/en/latest/

Upvotes: 0

cel
cel

Reputation: 31399

Q1: -n explicitly specifies environment - this command will run in any environment and even if you have no environment active.

Q2: In all but very few cases updating conda will not affect the packages ought to be installed in other environments. conda plays the role as a package manager. The packages are pulled from an index that is independent of conda's version.

Upvotes: 7

oussama Seffai
oussama Seffai

Reputation: 197

you deal with conda like any other package manager you update it in base environment by conda update -n base conda

conda update --all 

is meant to update all packages in the activated environment check this

Upvotes: 6

Related Questions