WillZ
WillZ

Reputation: 3955

Conda: How can I update just the packages I specify in my command?

I'm trying to update a single package in my latest Anaconda installation (release date 2020-07-31, Ubuntu 20.04.1), but lots of other package updates were suggested, including a few I don't necessarily want.

How can I narrow down to updating only the packages I care about?

Spec

Python version: 3.8.3

Conda version: 4.8.4

Problem Output

when I tried conda update numpy, conda either wants to update a lot of other packages, or complains that a specific version is pinned by anaconda package.

It doesn't need to be numpy, could be another package, like scipy. Below is what I got. Why are there so MANY packages? Can I not just get numpy and MOVE ON?

conda update numpy

# output below, why can't I just update numpy ONLY??
....

The following NEW packages will be INSTALLED:

  _anaconda_depends  pkgs/main/linux-64::_anaconda_depends-2020.07-py38_0
  argon2-cffi        pkgs/main/linux-64::argon2-cffi-20.1.0-py38h7b6447c_1
  gettext            pkgs/main/linux-64::gettext-0.19.8.1-hd7bead4_3
  iniconfig          pkgs/main/noarch::iniconfig-1.0.1-py_0
  libiconv           pkgs/main/linux-64::libiconv-1.15-h63c8f33_5

The following packages will be UPDATED:

  asn1crypto         pkgs/main/linux-64::asn1crypto-1.3.0-~ --> pkgs/main/noarch::asn1crypto-1.4.0-py_0
  bitarray                             1.4.0-py38h7b6447c_0 --> 1.5.2-py38h7b6447c_0
  blosc                                   1.19.0-hd408876_0 --> 1.20.0-hd408876_0
  fribidi                                  1.0.9-h7b6447c_0 --> 1.0.10-h7b6447c_0
  fsspec                                         0.7.4-py_0 --> 0.8.0-py_0
  gstreamer                               1.14.0-hb31296c_0 --> 1.14.0-hb453b48_1
  ipykernel                            5.3.2-py38h5ca1d4c_0 --> 5.3.4-py38h5ca1d4c_0
  ld_impl_linux-64   pkgs/main::ld_impl_linux-64-2.33.1-h5~ --> conda-forge::ld_impl_linux-64-2.34-hc38a660_9
  lz4-c                                    1.9.2-he6710b0_0 --> 1.9.2-he6710b0_1
  notebook                                     6.0.3-py38_0 --> 6.1.1-py38_0
  numpy                               1.18.5-py38ha1c710e_0 --> 1.19.1-py38hbc911f0_0
  numpy-base                          1.18.5-py38hde5b4d6_0 --> 1.19.1-py38hfa32c7d_0
  pandas                               1.0.5-py38h0573a6f_0 --> 1.1.0-py38he6710b0_0
  pandoc                                             2.10-0 --> 2.10.1-0
  path.py                                          12.4.0-0 --> 12.5.0-0
  pip                                         20.1.1-py38_1 --> 20.2.2-py38_0
  pytest                                       5.4.3-py38_0 --> 6.0.1-py38_0
  python                 pkgs/main::python-3.8.3-hcff3b4d_2 --> conda-forge::python-3.8.5-h1103e12_5_cpython
  regex                             2020.6.8-py38h7b6447c_0 --> 2020.7.14-py38h7b6447c_0
  scipy                                1.5.0-py38h0b6359f_0 --> 1.5.2-py38h0b6359f_0
  setuptools                                  49.2.0-py38_0 --> 49.6.0-py38_0
  sphinx                                         3.1.2-py_0 --> 3.2.1-py_0
  sphinxcontrib-web~                             1.2.3-py_0 --> 1.2.4-py_0
  sqlite                                  3.32.3-h62c20be_0 --> 3.33.0-h62c20be_0
  tbb                                     2020.0-hfd86e86_0 --> 2020.1-hfd86e86_0
  tblib                                          1.6.0-py_0 --> 1.7.0-py_0
  urllib3                                       1.25.9-py_0 --> 1.25.10-py_0

The following packages will be SUPERSEDED by a higher-priority channel:

  glib                    pkgs/main::glib-2.65.0-h3eb4bd4_0 --> conda-forge::glib-2.65.0-h6f030ca_0

The following packages will be DOWNGRADED:

  anaconda                                   2020.07-py38_0 --> custom-py38_1
  cffi                                1.14.0-py38he30daa8_1 --> 1.14.0-py38h2e261b9_0
  libffi                                     3.3-he6710b0_2 --> 3.2.1-hd88cf55_4
  zstd                                     1.4.5-h0b5b093_0 --> 1.4.5-h9ceee32_0


Proceed ([y]/n)? n

I did not like the fact that python was being updated to a conda-forge package (not that I have anything against conda-forge packages), since I did not ask for it.

Here is my $HOME/.condarc file:

channels:
  - defaults
  - pytorch
  - conda-forge

Appreciate your help here.

Upvotes: 7

Views: 30526

Answers (2)

CosmeticMichu
CosmeticMichu

Reputation: 133

try conda install pandas for example, if you want to update pandas. It will check for the last version of the package, and if the package is already installed, it will be updated.

Upvotes: 4

Rheatey Bash
Rheatey Bash

Reputation: 847

You can stop the dependencies update by disabling it in Anaconda. Details of this are explained here

You also need to pay attention to the official Note

Conda still ensures that dependency specifications are satisfied. Thus, some dependencies may still be updated or, conversely, this may prevent packages given at the command line from being updated to their latest versions. You can always specify versions at the command line to force conda to install a given version, such as conda install numpy=1.9.3.

You need to create a file .condarc in the home directory of the environment. then add this line.

update_dependencies: False

Details are here

Thereafter, you can install the package.

Upvotes: 4

Related Questions