Last updated: Apr 12, 2024
Reading time·4 min
The Anaconda error "Solving environment: failed with initial frozen solve. Retrying with flexible solve" occurs for multiple reasons:
anaconda
or the conda-forge
channel when installing the package.libmamba
solver when installing the package.Here is the complete error message.
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. Found conflicts! Looking for incompatible packages. This can take several minutes. Press CTRL-C to abort.
The first thing you should try is to specify the channel when running the installation command.
For example, you can first try to use your default channel.
conda install requests
Make sure to replace requests
with the name of the package you're trying to
install.
If that didn't work, try to use the conda-forge
channel.
conda install -c conda-forge requests
If that didn't work either, try to use the anaconda
channel.
conda install -c anaconda requests
If the issue persists, the package you are trying to install might not be compatible with your current Anaconda version.
You can try to update your conda
package by issuing the following command.
conda update conda
Also, update anaconda-navigator
.
conda update anaconda-navigator
To be sure that conda
has been updated, issue the following command.
conda update -n base -c defaults conda
Once Anaconda has been updated, issue your installation command.
conda install requests
You can also use the following command to update all packages in the environment before running your installation command.
conda update --all --yes
libmamba
If the error persists, you might be running into issues due to the old Anaconda solver.
Try to set the solver to libmamba
when issuing the installation command.
First, install the libmamba
solver.
conda install -n base conda-libmamba-solver
Now use the solver when installing your specific package.
conda install requests --solver=libmamba
If you want to set the libmamba
solver as your default, issue the following
command.
conda config --set solver libmamba
If you want to revert to the classic
solver (the default solver), issue the
following command.
conda install numpy --solver=classic
channel_priority
setting to flexible
or false
If the issue persists, try to set the channel_priority
setting to flexible
before issuing the installation command.
conda config --set channel_priority flexible
Now rerun the installation command.
conda install requests
If that didn't work, set the channel_priority
to false
.
conda config --set channel_priority false
Then rerun the installation command.
conda install requests
By default, the channel_priority
setting is set to strict
and this often
causes issues.
Another thing you can try is to recreate your virtual environment as it might be glitched.
conda deactivate
conda create --name my-env
Make sure to replace my-env
with the name of your virtual environment.
conda activate my-env
Make sure to replace my-env
with the name of your virtual environment.
conda install requests
conda-forge
channelIf the error persists, try to remove and add back the conda-forge
channel.
conda-forge
channel.conda config --remove channels conda-forge
conda install requests
conda-forge
channel.conda config --add channels conda-forge
pip
instead of conda
If none of the suggestions helped, you can try to use pip
instead of conda
.
pip install requests
Or you might have to use pip3
if you are on macOS or Linux.
pip3 install requests
You can learn more about the related topics by checking out the following tutorials: