Reputation: 729
When I type try to run conda update -n base conda
, conda hung for around 20-minutes on 'Solving environment' and then returned a package plan that did not include an updated version of conda. The package plan that was returned is provided below.
NOTE: conda update --all
solved the environment in a reasonable amount of time (~1 min - I didn't time it precisely).
conda update -n base conda
As I mentioned above, conda install websocket-client
also hung at 'Solving environment' - I already had websocket-client version 0.53.0 installed when I tried to run the install command
Conda should either:
Originally posted here: https://github.com/conda/conda/issues/7938
Upvotes: 46
Views: 44761
Reputation: 76750
Anaconda distribution is designed and tested to use the anaconda channel (a subset of defaults) as its primary channel. Adding conda-forge in either a higher- (channel_priority: strict
) or equal-priority (channel_priority: flexible
) configuration opens up many of the packages to be sourced from Conda Forge instead, and this is where Conda struggles to solve.
Including conda-forge both expands the search as well as opens other packages to be subject to channel switching, and since the anaconda
package includes dozens of packages, this can be a huge satisfiability problem to solve. This is often most problematic after the first time conda-forge is added into a user's configuration.
There are two high-level ways to improve performance: simplify the solving problem or use a faster solver. Of course, these are not mutually exclusive - feel free to be both thoughtful about what you demand of your solver and adopt optimized tools.
When the anaconda
metapackage is installed in an environment, keep the defaults channel at highest priority (first channel in .condarc
) and set channel_priority: strict
. See the documentation on Managing Channels.
Additionally, one can forcefully prioritize the defaults channel with commands like
conda update -n base --override-channels -c defaults conda
Update: This option is mostly obsolete. Beginning with Conda v23.11, the
libmamba
solver is now default inconda
, so unless an older Conda is being run,conda
andmamba
should have similar performance.
Mamba is a drop-in replacement for the conda
CLI that is faster (compiled) and in my experience tends to be more aggressive in pruning. Once installed, it runs similar to conda
, e.g.,
mamba update -n base conda
Many users find the coupling of their environment management infrastructure (Conda) to a large working environment (Anaconda) to be less than ideal. A popular alternative configuration is to maintain a minimal base environment, and if Anaconda is ever needed, to create a new environment with the anaconda
package installed.
Alternative options for base environments include
mamba
Upvotes: 31
Reputation: 26
For those of you who are having problems where the slow down is when it is collecting package metadata (e.g. repodata.json) does the experimental jlap option help? See the following blog post for more info.
https://conda.org/blog/2023-05-05-how-we-reduced-the-conda-index-fetch-bandwidth/
Upvotes: 0
Reputation: 385
A better answer for 2023, which is compatible with conda-forge: use the libmamba solver.
Conda is actually making this the default going forward, and things should be much faster.
Blog post: https://conda.org/blog/2023-07-05-conda-libmamba-solver-rollout/ Additional info: https://www.anaconda.com/blog/a-faster-conda-for-a-growing-community
To switch to the new solver, first do
conda update -n base conda
and then
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
Upvotes: 4
Reputation: 811
Upgrade your conda For particular conda version
conda install conda=4.7.12
For latest conda version
conda update -n base -c defaults conda
Upvotes: -3