Saturday, 31 October 2020

How to update conda

If conda is outdated, a warning will be displayed each time we try to use it:

Example #1:

(my-env) $ conda remove opencv
Collecting package metadata (repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.8.5
  latest version: 4.9.0

Please update conda by running

    $ conda update -n base -c defaults conda
...


Example #2:

(my-env) $ conda install -c conda-forge opencv
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.8.5
  latest version: 4.9.0

Please update conda by running

    $ conda update -n base -c defaults conda

...

Conda itself is updated just like any other conda package, with conda update command:

$ conda update --help
usage: conda update [-h] [-n ENVIRONMENT | -p PATH] [-c CHANNEL] [--use-local]
                    [--override-channels] [--repodata-fn REPODATA_FNS]
                    [--strict-channel-priority] [--no-channel-priority]
                    [--no-deps | --only-deps] [--no-pin] [--copy] [-C] [-k]
                    [--offline] [-d] [--json] [-q] [-v] [-y] [--download-only]
                    [--show-channel-urls] [--file FILE] [--force-reinstall]
                    [--freeze-installed | --update-deps | -S | --update-all | --update-specs]
                    [--clobber]
                    [package_spec [package_spec ...]]

Updates conda packages to the latest compatible version.

    This command accepts a list of package names and updates them to the latest
    versions that are compatible with all other packages in the environment.

    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.

Options:

positional arguments:
  package_spec          Packages to install or update in the conda
                        environment.

optional arguments:
  -h, --help            Show this help message and exit.
  --file FILE           Read package versions from the given file. Repeated
                        file specifications can be passed (e.g. --file=file1
                        --file=file2).

Target Environment Specification:
  -n ENVIRONMENT, --name ENVIRONMENT
                        Name of environment.
  -p PATH, --prefix PATH
                        Full path to environment location (i.e. prefix).

Channel Customization:
  -c CHANNEL, --channel CHANNEL
                        Additional channel to search for packages. These are
                        URLs searched in the order they are given (including
                        local directories using the 'file://' syntax or simply
                        a path like '/home/conda/mychan' or '../mychan').
                        Then, the defaults or channels from .condarc are
                        searched (unless --override-channels is given). You
                        can use 'defaults' to get the default packages for
                        conda. You can also use any name and the .condarc
                        channel_alias value will be prepended. The default
                        channel_alias is http://conda.anaconda.org/.
  --use-local           Use locally built packages. Identical to '-c local'.
  --override-channels   Do not search default or .condarc channels. Requires
                        --channel.
  --repodata-fn REPODATA_FNS
                        Specify name of repodata on remote server. Conda will
                        try whatever you specify, but will ultimately fall
                        back to repodata.json if your specs are not
                        satisfiable with what you specify here. This is used
                        to employ repodata that is reduced in time scope. You
                        may pass this flag more than once. Leftmost entries
                        are tried first, and the fallback to repodata.json is
                        added for you automatically.

Solver Mode Modifiers:
  --strict-channel-priority
                        Packages in lower priority channels are not considered
                        if a package with the same name appears in a higher
                        priority channel.
  --no-channel-priority
                        Package version takes precedence over channel
                        priority. Overrides the value given by `conda config
                        --show channel_priority`.
  --no-deps             Do not install, update, remove, or change
                        dependencies. This WILL lead to broken environments
                        and inconsistent behavior. Use at your own risk.
  --only-deps           Only install dependencies.
  --no-pin              Ignore pinned file.
  --force-reinstall     Ensure that any user-requested package for the current
                        operation is uninstalled and reinstalled, even if that
                        package already exists in the environment.
  --freeze-installed, --no-update-deps
                        Do not update or change already-installed
                        dependencies.
  --update-deps         Update dependencies.
  -S, --satisfied-skip-solve
                        Exit early and do not run the solver if the requested
                        specs are satisfied. Also skips aggressive updates as
                        configured by 'aggressive_update_packages'. Similar to
                        the default behavior of 'pip install'.
  --update-all, --all   Update all installed packages in the environment.
  --update-specs        Update based on provided specifications.

Package Linking and Install-time Options:
  --copy                Install all packages using copies instead of hard- or
                        soft-linking.
  --clobber             Allow clobbering of overlapping file paths within
                        packages, and suppress related warnings.

Networking Options:
  -C, --use-index-cache
                        Use cache of channel index files, even if it has
                        expired.
  -k, --insecure        Allow conda to perform "insecure" SSL connections and
                        transfers. Equivalent to setting 'ssl_verify' to
                        'false'.
  --offline             Offline mode. Don't connect to the Internet.

Output, Prompt, and Flow Control Options:
  -d, --dry-run         Only display what would have been done.
  --json                Report all output as json. Suitable for using conda
                        programmatically.
  -q, --quiet           Do not display progress bar.
  -v, --verbose         Can be used multiple times. Once for INFO, twice for
                        DEBUG, three times for TRACE.
  -y, --yes             Do not ask for confirmation.
  --download-only       Solve an environment and ensure package caches are
                        populated, but exit prior to unlinking and linking
                        packages into the prefix.
  --show-channel-urls   Show channel urls. Overrides the value given by `conda
                        config --show show_channel_urls`.

Examples:

    conda update -n myenv scipy

 

This is the command for updating the conda:


(my-env) $ conda update -n base -c defaults conda
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/bojan/anaconda3

  added / updated specs:
    - conda


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    conda-4.9.0                |           py38_0         2.9 MB
    conda-package-handling-1.7.2|   py38h03888b9_0         886 KB
    ------------------------------------------------------------
                                           Total:         3.7 MB

The following packages will be UPDATED:

  conda                                        4.8.5-py38_0 --> 4.9.0-py38_0
  conda-package-han~                   1.6.1-py38h7b6447c_0 --> 1.7.2-py38h03888b9_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
conda-4.9.0          | 2.9 MB    | ################################################################################################ | 100% 
conda-package-handli | 886 KB    | ################################################################################################ | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

No comments: