Failed with initial frozen solve. Retrying with flexible solve

avatar
Borislav Hadzhiev

Last updated: Apr 12, 2024
4 min

banner

# Failed with initial frozen solve. Retrying with flexible solve

The Anaconda error "Solving environment: failed with initial frozen solve. Retrying with flexible solve" occurs for multiple reasons:

  1. The package you are trying to install is not available in the specified channel.
  • Try to use the default channel, the default anaconda or the conda-forge channel when installing the package.
  1. Your version of Anaconda is not compatible with the version of the package you are trying to install.
  • Try to update your Anaconda version and rerun the installation command.
  1. Your Anaconda virtual environment is glitched.
  • Try to recreate your virtual environment and rerun the installation command.
  1. The old Anaconda solver cannot be used to install the specific package.
  • Try to use the libmamba solver when installing the package.

Here is the complete error message.

shell
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.

# Try to specify the conda channel when running the installation command

The first thing you should try is to specify the channel when running the installation command.

The package you are trying to install might not be available in the specified channel.

For example, you can first try to use your default channel.

shell
conda install requests

using default conda channel

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.

shell
conda install -c conda-forge requests

install conda forge channel

If that didn't work either, try to use the anaconda channel.

shell
conda install -c anaconda requests

try using anaconda channel

# Try to update your Anaconda version

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.

shell
conda update conda

update conda version

Also, update anaconda-navigator.

shell
conda update anaconda-navigator

update anaconda navigator

To be sure that conda has been updated, issue the following command.

shell
conda update -n base -c defaults conda

verify conda updated

Once Anaconda has been updated, issue your installation command.

shell
conda install requests

using default conda channel

You can also use the following command to update all packages in the environment before running your installation command.

shell
conda update --all --yes

# Try to set the solver to 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.

shell
conda install -n base conda-libmamba-solver

install libmamba solver

Now use the solver when installing your specific package.

shell
conda install requests --solver=libmamba

If you want to set the libmamba solver as your default, issue the following command.

shell
conda config --set solver libmamba

If you want to revert to the classic solver (the default solver), issue the following command.

shell
conda install numpy --solver=classic

# Try setting the 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.

shell
conda config --set channel_priority flexible

Now rerun the installation command.

shell
conda install requests

using default conda channel

If that didn't work, set the channel_priority to false.

shell
conda config --set channel_priority false

Then rerun the installation command.

shell
conda install requests

By default, the channel_priority setting is set to strict and this often causes issues.

# Try to recreate your virtual environment

Another thing you can try is to recreate your virtual environment as it might be glitched.

  1. If you need to exit your current virtual environment, use the following command.
shell
conda deactivate

exit conda virtual environment

  1. Now, create a new virtual environment.
shell
conda create --name my-env

conda create new virtual environment

Make sure to replace my-env with the name of your virtual environment.

  1. Activate your new virtual environment.
shell
conda activate my-env

activate new virtual environment

Make sure to replace my-env with the name of your virtual environment.

  1. Install the package in your new virtual environment.
shell
conda install requests

install package in new virtual environment

# Try removing and adding back the conda-forge channel

If the error persists, try to remove and add back the conda-forge channel.

  1. Issue the following command to remove the conda-forge channel.
shell
conda config --remove channels conda-forge
  1. Install your package.
shell
conda install requests
  1. Add back the conda-forge channel.
shell
conda config --add channels conda-forge

# Try using pip instead of conda

If none of the suggestions helped, you can try to use pip instead of conda.

shell
pip install requests

Or you might have to use pip3 if you are on macOS or Linux.

shell
pip3 install requests

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.