Skip to content

Resolving "Solving environment: failed with initial frozen solve" in Conda

Problem Statement

When installing packages with Conda, you may encounter the following error:

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.

This occurs because Conda's default dependency resolver struggles with complex package relationships. Common triggers include:

  • Conflicting package versions or dependencies
  • Package incompatibilities in your environment
  • Challenging dependencies from conda-forge or other channels
  • Large environments with many interdependent packages

The error indicates Conda is attempting multiple resolution strategies but failing to find a consistent set of packages that satisfy all requirements.

1. Use Conda's libmamba Solver (Official Recommendation)

Conda's developers recommend the faster, more efficient libmamba solver:

bash
# Install the solver plugin
conda install -n base conda-libmamba-solver

# Use for a single installation
conda install tensorflow --solver=libmamba

# OR set as default solver
conda config --set solver libmamba

Benefits

  • Solves complex environments in seconds instead of minutes
  • Maintains full compatibility with existing Conda packages
  • Officially supported (see Conda documentation)

2. Replace Conda with Mamba

Mamba is a drop-in alternative to Conda with a faster dependency resolver:

bash
# Install mamba in base environment
conda install -n base mamba -c conda-forge

# Use mamba for installations
mamba install python-pdfkit -c conda-forge

Compatibility Note

  • Installs packages from standard Conda channels
  • Requires installing mamba in your current environment first
  • May resolve conflicts Conda's older solvers can't handle

3. Adjust Channel Priority Settings

If you're using strict channel priority, relax the setting:

bash
conda config --set channel_priority flexible

After changing, retry your installation:

bash
conda install python-pdfkit -c conda-forge

4. Environment Isolation

For persistent issues, create a clean environment:

bash
# Create environment with specific channels
conda create -n pdf_env python=3.10 -c conda-forge

# Activate environment
conda activate pdf_env

# Install package
conda install python-pdfkit

Channel Consistency

  • Avoid mixing packages from defaults and conda-forge channels
  • Explicitly specify all channels during environment creation

Why These Solutions Work

  1. Modern Solvers (libmamba/mamba):

    • Use advanced SAT algorithms for dependency resolution
    • Handle version conflicts more efficiently
    • Reduce solve times from minutes to seconds
  2. Channel Priority Adjustment:

    • Allows using packages from lower-priority channels if needed
    • Helps when strict channel priorities cause artificial conflicts
  3. Environment Isolation:

    • Eliminates conflicts from existing packages
    • Provides a clean dependency tree for new installations

Best Practices

  1. Update Conda regularly:

    bash
    conda update -n base conda
  2. Prefer minimal environments over installing everything in base

  3. Always specify channels explicitly during installation

Avoid This Anti-Pattern

Using pip exclusively in your base environment often compounds dependency issues. Only use pip when packages are unavailable through Conda.

  1. Prioritize solutions in this order:
    • Use libmamba solver (official solution)
    • Try Mamba (community favorite)
    • Adjust channel settings
    • Create clean environments

These solutions address the core dependency resolution challenges causing "failed with initial frozen solve" errors while maintaining environment stability.