conda.api.Solver
- class DepsModifier(value)
Flags to enable alternate handling of dependencies.
- NOT_SET = 'not_set'
- NO_DEPS = 'no_deps'
- ONLY_DEPS = 'only_deps'
- class Solver(prefix, channels, subdirs=(), specs_to_add=(), specs_to_remove=(), repodata_fn='repodata.json', command=<conda.auxlib._Null object>)
A high-level API to conda's solving logic. Three public methods are provided to access a solution in various forms.
- solve_final_state(update_modifier=<conda.auxlib._Null object>, deps_modifier=<conda.auxlib._Null object>, prune=<conda.auxlib._Null object>, ignore_pinned=<conda.auxlib._Null object>, force_remove=<conda.auxlib._Null object>, should_retry_solve=False)
Gives the final, solved state of the environment.
- Parameters
update_modifier (UpdateModifier) -- An optional flag directing how updates are handled regarding packages already existing in the environment.
deps_modifier (DepsModifier) -- An optional flag indicating special solver handling for dependencies. The default solver behavior is to be as conservative as possible with dependency updates (in the case the dependency already exists in the environment), while still ensuring all dependencies are satisfied. Options include * NO_DEPS * ONLY_DEPS * UPDATE_DEPS * UPDATE_DEPS_ONLY_DEPS * FREEZE_INSTALLED
prune (bool) -- If
True
, the solution will not contain packages that were previously brought into the environment as dependencies but are no longer required as dependencies and are not user-requested.ignore_pinned (bool) -- If
True
, the solution will ignore pinned package configuration for the prefix.force_remove (bool) -- Forces removal of a package without removing packages that depend on it.
should_retry_solve (bool) -- Indicates whether this solve will be retried. This allows us to control whether to call find_conflicts (slow) in ssc.r.solve
- Returns
In sorted dependency order from roots to leaves, the package references for the solved state of the environment.
- Return type
Tuple[PackageRef]
- solve_for_diff(update_modifier=<conda.auxlib._Null object>, deps_modifier=<conda.auxlib._Null object>, prune=<conda.auxlib._Null object>, ignore_pinned=<conda.auxlib._Null object>, force_remove=<conda.auxlib._Null object>, force_reinstall=<conda.auxlib._Null object>, should_retry_solve=False)
Gives the package references to remove from an environment, followed by the package references to add to an environment.
- Parameters
deps_modifier (DepsModifier) -- See
solve_final_state()
.prune (bool) -- See
solve_final_state()
.ignore_pinned (bool) -- See
solve_final_state()
.force_remove (bool) -- See
solve_final_state()
.force_reinstall (bool) --
- For requested specs_to_add that are already satisfied in the environment,
instructs the solver to remove the package and spec from the environment, and then add it back--possibly with the exact package instance modified, depending on the spec exactness.
should_retry_solve (bool) -- See
solve_final_state()
.
- Returns
A two-tuple of PackageRef sequences. The first is the group of packages to remove from the environment, in sorted dependency order from leaves to roots. The second is the group of packages to add to the environment, in sorted dependency order from roots to leaves.
- Return type
Tuple[PackageRef], Tuple[PackageRef]
- solve_for_transaction(update_modifier=<conda.auxlib._Null object>, deps_modifier=<conda.auxlib._Null object>, prune=<conda.auxlib._Null object>, ignore_pinned=<conda.auxlib._Null object>, force_remove=<conda.auxlib._Null object>, force_reinstall=<conda.auxlib._Null object>, should_retry_solve=False)
Gives an UnlinkLinkTransaction instance that can be used to execute the solution on an environment.
- Parameters
deps_modifier (DepsModifier) -- See
solve_final_state()
.prune (bool) -- See
solve_final_state()
.ignore_pinned (bool) -- See
solve_final_state()
.force_remove (bool) -- See
solve_final_state()
.force_reinstall (bool) -- See
solve_for_diff()
.should_retry_solve (bool) -- See
solve_final_state()
.
- Returns
- Return type
UnlinkLinkTransaction