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.
Recommended Solutions
1. Use Conda's libmamba Solver (Official Recommendation)
Conda's developers recommend the faster, more efficient libmamba solver:
# 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:
# 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:
conda config --set channel_priority flexible
After changing, retry your installation:
conda install python-pdfkit -c conda-forge
4. Environment Isolation
For persistent issues, create a clean environment:
# 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
andconda-forge
channels - Explicitly specify all channels during environment creation
Why These Solutions Work
Modern Solvers (libmamba/mamba):
- Use advanced SAT algorithms for dependency resolution
- Handle version conflicts more efficiently
- Reduce solve times from minutes to seconds
Channel Priority Adjustment:
- Allows using packages from lower-priority channels if needed
- Helps when strict channel priorities cause artificial conflicts
Environment Isolation:
- Eliminates conflicts from existing packages
- Provides a clean dependency tree for new installations
Best Practices
Update Conda regularly:
bashconda update -n base conda
Prefer minimal environments over installing everything in
base
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.
- 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.