install#

Conda package installation logic.

Core logic for conda [create|install|update|remove] commands.

See conda.cli.main_create, conda.cli.main_install, conda.cli.main_update, and conda.cli.main_remove for the entry points into this module.

Classes#

Functions#

reinstall_packages(→ int)

Reinstall packages using conda install.

clone(src_arg, dst_prefix[, json, quiet, index_args])

get_revision(arg[, json])

get_index_args(→ dict[str, any])

Returns a dict of args required for fetching an index

validate_install_command(prefix[, command])

Executes a set of validations that are required before any installation

ensure_update_specs_exist(prefix, specs)

Checks that each spec that is requested as an update exists in the prefix

install(args, parser[, command])

Logic for conda install, conda update, and conda create.

install_clone(args, parser)

Executes an install of a new conda environment by cloning.

install_revision(args, parser)

Install a previous version of a conda environment

revert_actions(prefix[, revision, index])

handle_txn(unlink_link_transaction, prefix, args, newenv)

Attributes#

stderrlog#
reinstall_packages(args, specs: list[str], **kwargs) int#

Reinstall packages using conda install.

Helper for health fixes that need to reinstall packages.

Parameters:
  • args -- Parsed arguments namespace

  • specs -- Package specs to reinstall

  • kwargs -- Override default install options (e.g., force_reinstall=True)

Returns:

Exit code from install

clone(src_arg, dst_prefix, json=False, quiet=False, index_args=None)#
get_revision(arg, json=False)#
get_index_args(args) dict[str, any]#

Returns a dict of args required for fetching an index :param args: The args provided by the cli :returns: dict of index args

class TryRepodata(notify_success, repodata, last_repodata, index_args, allowed_errors)#
notify_success#
repodata#
last_repodata#
index_args#
allowed_errors#
__enter__()#
__exit__(exc_type, exc_value, traceback)#
class Repodatas(repodata_fns, index_args, allows_errors=())#
repodata_fns#
index_args#
success = False#
allowed_errors#
__iter__()#
succeed()#
validate_install_command(prefix: str, command: str = 'install')#

Executes a set of validations that are required before any installation command is executed. This includes:

  • ensure the configuration is valid

  • ensuring the user in not an admin

  • ensure the user is not forcing 32bit installs in the root prefix

Parameters:
  • prefix -- The prefix where the environment will be created

  • command -- Type of operation being performed

Raises:

error if the configuration for the install is bad

ensure_update_specs_exist(prefix: str, specs: list[str])#

Checks that each spec that is requested as an update exists in the prefix

Parameters:
  • prefix -- The target install prefix

  • specs -- List of specs to be updated

Raises:
install(args, parser, command='install')#

Logic for conda install, conda update, and conda create.

install_clone(args, parser)#

Executes an install of a new conda environment by cloning.

install_revision(args, parser)#

Install a previous version of a conda environment

revert_actions(prefix, revision=-1, index: conda.core.index.Index | None = None)#
handle_txn(unlink_link_transaction, prefix, args, newenv, remove_op=False)#