Documentation Index
Fetch the complete documentation index at: https://mintlify.com/conda/conda/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheSolver class provides high-level access to conda’s dependency solving logic. It takes a set of package specifications and computes the optimal set of packages to install, update, or remove from an environment.
Constructor
The conda prefix / environment location for which the Solver is being instantiated.
A prioritized list of channels to use for the solution. Can be Channel objects or strings.
A prioritized list of subdirs to use for the solution (e.g.,
["linux-64", "noarch"]).The set of package specs to add to the prefix.
The set of package specs to remove from the prefix.
Methods
solve_final_state
An optional flag indicating special solver handling for updates. See
conda.api.UpdateModifier.An optional flag indicating special solver handling for dependencies. The default solver behavior is to be as conservative as possible with dependency updates while still ensuring all dependencies are satisfied.Options include:
NO_DEPS- Don’t install dependenciesONLY_DEPS- Install only dependencies, not the requested packagesUPDATE_DEPS- Update dependencies to their latest versionsUPDATE_DEPS_ONLY_DEPS- Update only dependenciesFREEZE_INSTALLED- Don’t update any installed packages
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.If
True, the solution will ignore pinned package configuration for the prefix.Forces removal of a package without removing packages that depend on it.
In sorted dependency order from roots to leaves, the package references for the solved state of the environment.
Example
solve_for_diff
See
solve_final_state.See
solve_final_state.See
solve_final_state.See
solve_final_state.See
solve_final_state.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.
A two-tuple of PackageRef sequences:
- First tuple: packages to remove from the environment, in sorted dependency order from leaves to roots
- Second tuple: packages to add to the environment, in sorted dependency order from roots to leaves
Example
solve_for_transaction
UnlinkLinkTransaction instance that can be used to execute the solution on an environment.
See
solve_final_state.See
solve_final_state.See
solve_final_state.See
solve_final_state.See
solve_final_state.See
solve_for_diff.A transaction object that can be executed to apply the changes to the environment.