[Conda] Error: ResolvePackageNotFound — package not available in Conda channels — How to Fix It
Summary
The Conda error ResolvePackageNotFound occurs when Conda cannot locate one or more packages listed in your install or environment file. It means those packages are not present in the currently configured channels. The solution is to add missing repositories like conda-forge, correct any typos or platform-specific dependencies, or install unavailable packages using pip.
Context
When creating or updating an environment, Conda resolves dependencies by checking all configured channels listed in your .condarc file or YAML specification. If a required package or version cannot be found in any of those sources, Conda stops with a ResolvePackageNotFound error. This commonly happens when using environment files shared between different operating systems, such as including Windows-only packages like pywin32 in Linux setups. The error also appears when using Miniconda without enabling the conda-forge channel or when metadata is outdated.
Probable Cause
- The package is unavailable in your active Conda channels.
- Environment YAML includes OS-specific or invalid dependencies.
- Outdated Conda cache or metadata preventing discovery of new packages.
- Typographical error in the package name or version constraint.
- Minimal Conda installation lacking additional community channels (e.g., conda-forge).
Quick Fix
Use these steps to identify and fix missing package sources:
- Check your configured Conda channels:
conda config --show channels
- If
conda-forgeis missing, add it:
conda config --add channels conda-forge
- Retry your installation:
conda install
- If you’re creating an environment from a YAML file, open it and check for platform-specific or unavailable packages. For example:
- pywin32 # Windows only
- libgcc-ng # Linux only
Comment out or remove such entries before running:
conda env create -f environment.yml
- Update Conda’s metadata and reattempt installation:
conda update conda
- If the package isn’t in Conda at all, install it via
pipinside your environment:
pip install
Full Example
A user tries to build an environment:
conda env create -f environment.yml
and receives:
ResolvePackageNotFound:
- pywin32
- libgcc-ng
The YAML file contains both Windows and Linux dependencies. To fix it, they remove those lines and ensure conda-forge is added as a channel:
conda config --add channels conda-forge
conda env create -f environment.yml
The environment now builds successfully. If a missing library like pydantic isn’t in Conda, they complete the setup with:
pip install pydantic
Pitfalls & Debug
- Symptom: Error occurs on one OS only → Fix: Remove platform-specific packages from
environment.yml. - Symptom: “Package not available” after adding channels → Fix: Run
conda clean --index-cacheto refresh metadata. - Symptom: Using Miniconda base install → Fix: Always enable
conda-forgefor broader coverage. - Symptom: Repeated YAML import errors → Fix: Use
conda env export --no-buildsfor cross-platform compatibility. - Symptom: Package exists only on PyPI → Fix: Install it with
pipinside your environment.
Validation & Next Steps
Confirm availability of the package and correct channels:
conda search
conda config --show channels
Inspect the active environment file for invalid entries and re-run the environment creation. Regularly update Conda and cache metadata to ensure access to the latest package indices.
Sources
Anaconda Documentation — Managing environments