Reputation: 189676
What is the difference between conda install
and conda update
? I've skimmed through the documentation and I don't see any obvious difference.
The documentation says:
From conda install
:
Conda attempts to install the newest versions of the requested packages. To accomplish this, it may update some packages that are already installed, or install additional packages. To prevent existing packages from updating, use the --no-update-deps option. This may force conda to install older versions of the requested packages, and it does not prevent additional dependency packages from being installed.
From conda update
:
Conda attempts to install the newest versions of the requested packages. To accomplish this, it may update some packages that are already installed, or install additional packages. To prevent existing packages from updating, use the --no-update-deps option. This may force conda to install older versions of the requested packages, and it does not prevent additional dependency packages from being installed.
Upvotes: 7
Views: 8082
Reputation: 333
In the context of the text from the documentation that was cited in the question
... Conda attempts to install the newest versions of the requested packages....
it seems important to stress that the documentation is not perfectly clear about the difference between install and update. The fact that the documentation shares the same explanation about what is installed without clarifying the conditions is certainly a bit confusing (at least to me).
The implicit distinction between installing and updating is not only that you get an error if you try to update a package that does not exist (what was mentioned in the comments to the question), but also that the side-effects (handling of dependencies) are different for install
and update
.
A real world example:
(base) 535> conda install -d sphinx
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /data/anaconda3
added / updated specs:
- sphinx
The following packages will be downloaded:
package | build
---------------------------|-----------------
sphinx-3.0.3 | py_0 1.1 MB
------------------------------------------------------------
Total: 1.1 MB
The following packages will be UPDATED:
sphinx 2.4.0-py_0 --> 3.0.3-py_0
while updating leads to
(base) 536> conda update -d sphinx
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /data/anasynth_nonbp/anaconda3
added / updated specs:
- sphinx
The following packages will be downloaded:
package | build
---------------------------|-----------------
astroid-2.4.1 | py36_0 279 KB
...
sphinx-3.0.3 | py_0 1.1 MB
...
zipp-3.1.0 | py_0 13 KB
------------------------------------------------------------
Total: 39.8 MB
The following NEW packages will be INSTALLED:
importlib-metadata pkgs/main/linux-64::importlib-metadata-1.6.0-py36_0
prompt-toolkit pkgs/main/noarch::prompt-toolkit-3.0.4-py_0
toml pkgs/main/linux-64::toml-0.10.0-py36h28b3542_0
The following packages will be REMOVED:
asn1crypto-1.3.0-py36_0
The following packages will be UPDATED:
astroid 2.3.3-py36_0 --> 2.4.1-py36_0
...
sphinx 2.4.0-py_0 --> 3.0.3-py_0
...
zipp 2.2.0-py_0 --> 3.1.0-py_0
Without having investigated this into the last details it seems one can summarize as follows (last tested with conda 4.8.3
):
conda install
installs the newest version of the requested package with minimal changes to the installed packages.
conda update
will update to the most recent version if the package exists and will give an error if not. Furthermore it also updates all dependencies of the packages listed as argument. conda update
will update these even if the package in the argument is already the latest version.
Upvotes: 6
Reputation: 445
It's exactly what the documentation you provided says. For conda install:
Installs a list of packages into a specified conda environment.
and for conda update:
Updates conda packages to the latest compatible version.
Upvotes: 3